-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ade9d98
commit 499dc88
Showing
1 changed file
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,12 @@ otherwise a NULL value (``dbNullVal``) will be used. | |
|
||
``dbValOrNull()`` accepts all types due to `value: auto`. | ||
|
||
## Auto NULL-values | ||
|
||
There are two generators, which can generate the `NULL` values for you. | ||
|
||
* `genArgs` does only set a field to `NULL` if `dbNullVal`/`dbValOrNull()` is passed. | ||
* `genArgsSetNull` sets empty field (`""` / `c.len() == 0`) to `NULL`. | ||
|
||
## Executing DB commands | ||
|
||
|
@@ -50,12 +56,6 @@ The examples below support the various DB commands such as ``exec``, | |
All the examples uses a table named: ``myTable`` and they use the WHERE argument on: ``name``. | ||
|
||
|
||
## genArgs / genArgsSetNull | ||
|
||
* `genArgs` does only set a field to `NULL` if `dbNullVal` is passed. | ||
* `genArgsSetNull` sets empty field to `NULL`. | ||
|
||
|
||
## Update string & int | ||
|
||
### Version 1 | ||
|
@@ -76,6 +76,14 @@ All the examples uses a table named: ``myTable`` and they use the WHERE argument | |
``` | ||
|
||
|
||
### Version 3 | ||
```nim | ||
let a = genArgsSetNull("[email protected]", "", "John") | ||
exec(db, sqlUpdate("myTable", ["email", "age"], ["name"], a.query), a.args) | ||
# ==> string, NULL | ||
# ==> UPDATE myTable SET email = ?, age = NULL WHERE name = ? | ||
``` | ||
|
||
|
||
## Update NULL & int | ||
|
||
|