SQL Server has no TRUE / FALSE literals
Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
parent
c98df6dd97
commit
0f26e7d060
3 changed files with 10 additions and 2 deletions
|
|
@ -1,5 +1,8 @@
|
|||
# Changes
|
||||
|
||||
* 2.6.next in progress
|
||||
* Make SQL Server dialect auto-lift Boolean values to parameters since SQL Server has no `TRUE` / `FALSE` literals.
|
||||
|
||||
* 2.6.1243 -- 2024-12-13
|
||||
* Address [#558](https://github.com/seancorfield/honeysql/issues/558) by adding `:patch-into` (and `patch-into` helper) for XTDB (but in core).
|
||||
* Address [#556](https://github.com/seancorfield/honeysql/issues/556) by adding an XTDB section to the documentation with examples.
|
||||
|
|
|
|||
|
|
@ -112,7 +112,8 @@
|
|||
(assoc m k (assoc v :dialect k)))
|
||||
{}
|
||||
{:ansi {:quote #(strop "\"" % "\"")}
|
||||
:sqlserver {:quote #(strop "[" % "]")}
|
||||
:sqlserver {:quote #(strop "[" % "]")
|
||||
:auto-lift-boolean true}
|
||||
:mysql {:quote #(strop "`" % "`")
|
||||
:clause-order-fn
|
||||
#(add-clause-before % :set :where)}
|
||||
|
|
@ -2233,7 +2234,9 @@
|
|||
(into [(str "(" (join ", " sqls) ")")] params))))
|
||||
|
||||
(boolean? expr)
|
||||
[(upper-case (str expr))]
|
||||
(if (:auto-lift-boolean *dialect*)
|
||||
["?" expr]
|
||||
[(upper-case (str expr))])
|
||||
|
||||
(nil? expr)
|
||||
["NULL"]
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
(sut/format-expr [:is :id nil])))
|
||||
(is (= ["id = TRUE"]
|
||||
(sut/format-expr [:= :id true])))
|
||||
(is (= ["[id] = ?" true]
|
||||
(sut/format [:= :id true] {:dialect :sqlserver})))
|
||||
(is (= ["id IS TRUE"]
|
||||
(sut/format-expr [:is :id true])))
|
||||
(is (= ["id <> TRUE"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue