diff --git a/CHANGELOG.md b/CHANGELOG.md index 723bca8..548e398 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/honey/sql.cljc b/src/honey/sql.cljc index f5ec8d3..60a05f2 100644 --- a/src/honey/sql.cljc +++ b/src/honey/sql.cljc @@ -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)]