Fix SQL quoting when calling honeysql/format (#175). r=rnewman
This commit is contained in:
parent
a17142673e
commit
84a80f40f5
2 changed files with 14 additions and 2 deletions
|
@ -110,7 +110,7 @@
|
||||||
(->
|
(->
|
||||||
context
|
context
|
||||||
context->sql-clause
|
context->sql-clause
|
||||||
(sql/format args :quoting sql-quoting-style)))
|
(sql/format :params args :quoting sql-quoting-style)))
|
||||||
|
|
||||||
(defn- validate-with [with]
|
(defn- validate-with [with]
|
||||||
(when-not (or (nil? with)
|
(when-not (or (nil? with)
|
||||||
|
@ -215,7 +215,7 @@
|
||||||
[context find args]
|
[context find args]
|
||||||
(->
|
(->
|
||||||
(find->sql-clause context find)
|
(find->sql-clause context find)
|
||||||
(sql/format args :quoting sql-quoting-style)))
|
(sql/format :params args :quoting sql-quoting-style)))
|
||||||
|
|
||||||
(defn parse
|
(defn parse
|
||||||
"Parse a Datalog query array into a structured `find` expression."
|
"Parse a Datalog query array into a structured `find` expression."
|
||||||
|
|
|
@ -925,3 +925,15 @@
|
||||||
{:select ['x]
|
{:select ['x]
|
||||||
:from [:def]})}
|
:from [:def]})}
|
||||||
:foo])})))))
|
:foo])})))))
|
||||||
|
|
||||||
|
(deftest-db test-sql-quoting conn
|
||||||
|
(testing "ansi sql quoting applied when there are no inputs"
|
||||||
|
(is (= ["SELECT DISTINCT \"datoms0\".\"e\" AS \"order\" FROM \"datoms\" \"datoms0\" WHERE (\"datoms0\".\"a\" = \"order\") "]
|
||||||
|
(datomish.query/find->sql-string
|
||||||
|
(conn->context conn)
|
||||||
|
(datomish.query/parse
|
||||||
|
'[:find ?order
|
||||||
|
:in $
|
||||||
|
:where
|
||||||
|
[?order :item/order]])
|
||||||
|
nil)))))
|
||||||
|
|
Loading…
Reference in a new issue