Format sequential values as full SQL expressions
This commit is contained in:
parent
2decf35072
commit
ccd5447a09
2 changed files with 8 additions and 4 deletions
|
|
@ -511,7 +511,7 @@ RIGHT JOIN bock ON bock.z = c.e
|
|||
WHERE ((f.a = ?) AND (b.baz <> ?)) OR ((? < ?) AND (? < ?)) OR (f.e IN (?, ?, ?)) OR f.e BETWEEN ? AND ?
|
||||
GROUP BY f.a, c.e
|
||||
HAVING ? < f.e
|
||||
ORDER BY b.baz DESC, c.quux, f.a NULLS FIRST
|
||||
ORDER BY b.baz DESC, c.quux ASC, f.a NULLS FIRST
|
||||
LIMIT ?
|
||||
OFFSET ?
|
||||
"
|
||||
|
|
|
|||
|
|
@ -619,9 +619,8 @@
|
|||
(str " " (first sqls))
|
||||
(str "(" (str/join ", " sqls) ")")))]
|
||||
params)))
|
||||
(if *inline*
|
||||
[(str "(" (str/join ", " (map #'sqlize-value x)) ")")]
|
||||
(into [(str "(" (str/join ", " (repeat (count x) "?")) ")")] x))))
|
||||
(let [[sqls params] (format-expr-list x)]
|
||||
(into [(str "(" (str/join ", " sqls) ")")] params))))
|
||||
|
||||
(or (true? x) (false? x)) ; because (boolean? x) requires Clojure 1.9+
|
||||
[(upper-case (str x))]
|
||||
|
|
@ -760,4 +759,9 @@
|
|||
{:dialect :mysql}))
|
||||
(println (format {:select [:*] :from [:table]
|
||||
:where [:in :id [1 2 3 4]]} {:pretty? true}))
|
||||
(println (format {:select [:*] :from [:table]
|
||||
:where [:and [:in :id [1 [:param :foo]]]
|
||||
[:= :bar [:param :quux]]]}
|
||||
{:params {:foo 42 :quux 13}
|
||||
:pretty? true}))
|
||||
,)
|
||||
|
|
|
|||
Loading…
Reference in a new issue