Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1.59 KB

Update-Statement-Representation.adoc

File metadata and controls

63 lines (47 loc) · 1.59 KB

Update Statement Representation

The map below shows the structure of the update statement. The sql-stmt, op, source and set-cols keys are required.

{:sql-stmt :update
 :op ...sql-kw...
 :source ...name...
 :indexed-by ...name-or-nil...
 :set-cols ...col-map...
 :where ...expr...
 :order-by ...order-item-list...
 :limit ...expr...
 :offset ...expr...}

Source

...name... is anything convertible to a table name, usually a keyword.

Indexed-by

:indexed-by is anything convertible to an index name, usually a keyword.

Here’s how :indexed-by would be used…​

{:source :tbl}
;; UPDATE tbl
{:source :tbl :indexed-by nil}
;; UPDATE tbl NOT INDEXED
{:source :tbl :indexed-by :ix}
;; UPDATE tbl INDEXED BY ix

Op

The :op key can be anything convertible by to-sql-keywords. Syntax will be provided for at least these update operations.

#{:update, :update-or-rollback, :update-or-abort, :update-or-replace
  :update-or-fail, :update-or-ignore}

Set-cols

The :set-cols value must be a map from column names to values. The keys can be anything convertible to a column name (most commonly a keyword). The values are expressions

Other Clauses

The remaining clauses have the same meaning as in select statements.

SQLite optionally allows ORDER BY, LIMIT and OFFSET clauses, but they may not be standard SQL.