Fix SQL quoting when calling honeysql/format (#175). r=rnewman

This commit is contained in:
Paul 2017-01-15 11:27:06 -08:00 committed by Richard Newman
parent a17142673e
commit 84a80f40f5
2 changed files with 14 additions and 2 deletions

View file

@ -110,7 +110,7 @@
(->
context
context->sql-clause
(sql/format args :quoting sql-quoting-style)))
(sql/format :params args :quoting sql-quoting-style)))
(defn- validate-with [with]
(when-not (or (nil? with)
@ -215,7 +215,7 @@
[context find args]
(->
(find->sql-clause context find)
(sql/format args :quoting sql-quoting-style)))
(sql/format :params args :quoting sql-quoting-style)))
(defn parse
"Parse a Datalog query array into a structured `find` expression."

View file

@ -925,3 +925,15 @@
{:select ['x]
:from [:def]})}
: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)))))