fixes #533 by adding mostly undocumented *escape-?* dynvar

Signed-off-by: Sean Corfield <sean@corfield.org>
This commit is contained in:
Sean Corfield 2024-06-13 09:28:06 -07:00
parent 544992be88
commit b07ac78d68
No known key found for this signature in database
2 changed files with 6 additions and 1 deletions

View file

@ -1,6 +1,7 @@
# Changes
* 2.6.next in progress
* Address [#533](https://github.com/seancorfield/honeysql/issues/533) by adding `honey.sql/*escape-?*` which can be bound to `false` to prevent `?` being escaped to `??` when used as an operator, function, or
* Update JDK test matrix (adopt -> temurin, 19 -> 21).
* 2.6.1147 -- 2024-06-12

View file

@ -156,6 +156,8 @@
;; caching data to detect expressions that cannot be cached:
(def ^:private ^:dynamic *caching* nil)
(def ^:private ^:dynamic *numbered* nil)
;; #533 mostly undocumented dynvar to prevent ? -> ?? escaping:
(def ^:no-doc ^:dynamic *escape-?* true)
;; clause helpers
@ -339,7 +341,9 @@
Any ? is escaped to ??."
[k]
(when k
(let [n (str/replace (name k) "?" "??")]
(let [n (cond-> (name k)
*escape-?*
(str/replace "?" "??"))]
(if (= \' (first n))
(let [ident (subs n 1)
ident-l (str/lower-case ident)]