tentative impl of VALUES statement in MySQL #544
Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
parent
48edb03b32
commit
3ca197b45c
2 changed files with 7 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
* 2.6.next in progress
|
* 2.6.next in progress
|
||||||
* Performance optimizations via PRs [#545](https://github.com/seancorfield/honeysql/pull/545) and [#546](https://github.com/seancorfield/honeysql/pull/546) [@alexander-yakushev](https://github.com/alexander-yakushev).
|
* Performance optimizations via PRs [#545](https://github.com/seancorfield/honeysql/pull/545) and [#546](https://github.com/seancorfield/honeysql/pull/546) [@alexander-yakushev](https://github.com/alexander-yakushev).
|
||||||
|
* Address [#544](https://github.com/seancorfield/honeysql/issues/544) by adding support for MySQL's `VALUES ROW(..)` syntax. Docs TBD.
|
||||||
* Fix [#543](https://github.com/seancorfield/honeysql/issues/543) by supporting both symbols and keywords in named parameters.
|
* Fix [#543](https://github.com/seancorfield/honeysql/issues/543) by supporting both symbols and keywords in named parameters.
|
||||||
* Address [#541](https://github.com/seancorfield/honeysql/issues/541) by specifying the expected result of a formatter function passed to `register-clause!` and adding the example from the README to **Extending HoneySQL**.
|
* Address [#541](https://github.com/seancorfield/honeysql/issues/541) by specifying the expected result of a formatter function passed to `register-clause!` and adding the example from the README to **Extending HoneySQL**.
|
||||||
* Getting Started updated based on feedback from Los Angeles Clojure meetup walkthrough [#539](https://github.com/seancorfield/honeysql/issues/539).
|
* Getting Started updated based on feedback from Los Angeles Clojure meetup walkthrough [#539](https://github.com/seancorfield/honeysql/issues/539).
|
||||||
|
|
|
||||||
|
|
@ -1059,7 +1059,9 @@
|
||||||
")"))]))))
|
")"))]))))
|
||||||
|
|
||||||
(defn- format-values [k xs]
|
(defn- format-values [k xs]
|
||||||
(let [first-xs (when (sequential? xs) (first (drop-while ident? xs)))]
|
(let [first-xs (when (sequential? xs) (first (drop-while ident? xs)))
|
||||||
|
row-ctr (and (sequential? xs) (contains? #{:row 'rows} (first xs)))
|
||||||
|
xs (if row-ctr (rest xs) xs)]
|
||||||
(cond (and (ident? xs) (contains? #{:default 'default} xs))
|
(cond (and (ident? xs) (contains? #{:default 'default} xs))
|
||||||
[(str (sql-kw xs) " " (sql-kw k))]
|
[(str (sql-kw xs) " " (sql-kw k))]
|
||||||
(empty? xs)
|
(empty? xs)
|
||||||
|
|
@ -1087,7 +1089,8 @@
|
||||||
(map #(if (sequential? %)
|
(map #(if (sequential? %)
|
||||||
(format-expr-list %)
|
(format-expr-list %)
|
||||||
[(sql-kw %)])
|
[(sql-kw %)])
|
||||||
xs'))]
|
xs'))
|
||||||
|
sqls (if row-ctr (map #(str "ROW" %) sqls) sqls)]
|
||||||
(into [(str (sql-kw k) " " (join ", " sqls))] params))
|
(into [(str (sql-kw k) " " (join ", " sqls))] params))
|
||||||
|
|
||||||
(map? first-xs)
|
(map? first-xs)
|
||||||
|
|
@ -2364,6 +2367,7 @@
|
||||||
(format-expr 1)
|
(format-expr 1)
|
||||||
(format {:select [:a [:b :c] [[:d :e]] [[:f :g] :h]]})
|
(format {:select [:a [:b :c] [[:d :e]] [[:f :g] :h]]})
|
||||||
(format {:select [[[:d :e]] :a [:b :c]]})
|
(format {:select [[[:d :e]] :a [:b :c]]})
|
||||||
|
(format {:values [:row [1 2] [3 4]]})
|
||||||
(format-on-expr :where [:= :id 1])
|
(format-on-expr :where [:= :id 1])
|
||||||
(format-dsl {:select [:*] :from [:table] :where [:= :id 1]})
|
(format-dsl {:select [:*] :from [:table] :where [:= :id 1]})
|
||||||
(format {:select [:t.*] :from [[:table :t]] :where [:= :id 1]} {})
|
(format {:select [:t.*] :from [[:table :t]] :where [:= :id 1]} {})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue