Skip to content

Commit 499dc88

Browse files
committed
update readme
1 parent ade9d98 commit 499dc88

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ otherwise a NULL value (``dbNullVal``) will be used.
3838

3939
``dbValOrNull()`` accepts all types due to `value: auto`.
4040

41+
## Auto NULL-values
42+
43+
There are two generators, which can generate the `NULL` values for you.
44+
45+
* `genArgs` does only set a field to `NULL` if `dbNullVal`/`dbValOrNull()` is passed.
46+
* `genArgsSetNull` sets empty field (`""` / `c.len() == 0`) to `NULL`.
4147

4248
## Executing DB commands
4349

@@ -50,12 +56,6 @@ The examples below support the various DB commands such as ``exec``,
5056
All the examples uses a table named: ``myTable`` and they use the WHERE argument on: ``name``.
5157

5258

53-
## genArgs / genArgsSetNull
54-
55-
* `genArgs` does only set a field to `NULL` if `dbNullVal` is passed.
56-
* `genArgsSetNull` sets empty field to `NULL`.
57-
58-
5959
## Update string & int
6060

6161
### Version 1
@@ -76,6 +76,14 @@ All the examples uses a table named: ``myTable`` and they use the WHERE argument
7676
```
7777

7878

79+
### Version 3
80+
```nim
81+
let a = genArgsSetNull("em@em.com", "", "John")
82+
exec(db, sqlUpdate("myTable", ["email", "age"], ["name"], a.query), a.args)
83+
# ==> string, NULL
84+
# ==> UPDATE myTable SET email = ?, age = NULL WHERE name = ?
85+
```
86+
7987

8088
## Update NULL & int
8189

0 commit comments

Comments
 (0)