document values row (docs also test)
Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
parent
7c0e25f253
commit
a27f72eab9
2 changed files with 19 additions and 0 deletions
|
|
@ -1305,6 +1305,21 @@ In addition, all of the rows are padded to the same length by adding `nil`
|
|||
values if needed (since `:values` does not know how or if column
|
||||
names are being used in this case).
|
||||
|
||||
### values row (MySQL)
|
||||
|
||||
MySQL supports `VALUES` as a table expression in multiple
|
||||
contexts, and it uses "row constructors" to represent the
|
||||
rows of values.
|
||||
|
||||
HoneySQL supports this by using the keyword `:row` (or
|
||||
symbol `'row`) as the first element of a sequence of values.
|
||||
|
||||
|
||||
```clojure
|
||||
user=> (sql/format {:values [:row [1 2] [3 4]]})
|
||||
["VALUES ROW(?, ?), ROW(?, ?)" 1 2 3 4]
|
||||
```
|
||||
|
||||
### values examples
|
||||
|
||||
```clojure
|
||||
|
|
|
|||
|
|
@ -2370,6 +2370,10 @@
|
|||
(format {:select [:a [:b :c] [[:d :e]] [[:f :g] :h]]})
|
||||
(format {:select [[[:d :e]] :a [:b :c]]})
|
||||
(format {:values [:row [1 2] [3 4]]})
|
||||
(format {:with [[[:stuff {:columns [:id :name]}]
|
||||
{:values [:row [1 "Sean"] [2 "Jay"]]}]]
|
||||
:select [:id :name]
|
||||
:from [:stuff]})
|
||||
(format-on-expr :where [:= :id 1])
|
||||
(format-dsl {:select [:*] :from [:table] :where [:= :id 1]})
|
||||
(format {:select [:t.*] :from [[:table :t]] :where [:= :id 1]} {})
|
||||
|
|
|
|||
Loading…
Reference in a new issue