{:sql-stmt :insert
:op ...sql-kw...
:source ...name...
:columns ...col-list...
:values ...values...}
The structure of the insert statement is based on SQLite syntax.
{:sql-stmt :insert
:op ...sql-kw...
:source ...name...
:columns ...col-list...
:values ...values...}
...name... is anything convertible to a table name, usually a keyword.
The :op key can be anything convertible by to-sql-keywords.
Syntax will be provided for at least these insert operations.
#{:insert, :insert-or-rollback, :insert-or-abort, :insert-or-replace
:insert-or-fail, :insert-or-ignore, :replace}
...col-list... can be a single column name or a collection of them.
Any given column must be convertible to a column name (most commonly a keyword).
...values... is either the keyword :default, a select statement, or a collection of rows where each row is itself a collection of expressions.
:columns is ignored if :values is :default.
(values :default) ; => DEFAULT VALUES
(values ...select...) ; use a select statement for the values
(values [r1c1 r1c2 r1c3] [r2c1 r2c2 r2c3] ...) ; each arg is a row value
;; VALUES (r1c1, r1c2, r1c3), (r2c1, r2c2, r2c3), ...
(value c1 c2 c3 ...) ; insert one value; each arg is a column value
;; VALUES (c1, c2, c3, ...)
The default-values or just defaults functions produce the following map:
{:columns nil
:values :default}
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |