Merge 084183ea94 into 88bc556578
This commit is contained in:
commit
1d648a1b54
4 changed files with 7 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -11,3 +11,4 @@ pom.xml
|
|||
.classpath
|
||||
.project
|
||||
bin
|
||||
/.nrepl-port
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
(defproject honeysql "0.4.3"
|
||||
(defproject honeysql "0.4.4-SNAPSHOT"
|
||||
:description "SQL as Clojure data structures"
|
||||
:license {:name "Eclipse Public License"
|
||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@
|
|||
(-to-sql [x] (.s x))
|
||||
clojure.lang.IPersistentMap
|
||||
(-to-sql [x] (let [clause-ops (concat
|
||||
(filter #(contains? x %) clause-order)
|
||||
(filter #(and (contains? x %) (get x %)) clause-order)
|
||||
(remove known-clauses (keys x)))
|
||||
sql-str (binding [*subquery?* true
|
||||
*fn-context?* false]
|
||||
|
|
|
|||
|
|
@ -54,4 +54,7 @@
|
|||
["SELECT DISTINCT f.*, b.baz, c.quux, b.bla AS bla_bla, now(), @x := 10 FROM foo f, baz b INNER JOIN draq ON f.b = draq.x LEFT JOIN clod c ON f.a = c.d RIGHT JOIN bock ON bock.z = c.e WHERE ((f.a = ? AND b.baz <> ?) OR (1 < 2 AND 2 < 3) OR (f.e in (1, ?, 3)) OR f.e BETWEEN 10 AND 20) GROUP BY f.a HAVING 0 < f.e ORDER BY b.baz DESC, c.quux LIMIT 50 OFFSET 10 "
|
||||
"bort" "gabba" 2])))
|
||||
(testing "SQL data prints and reads correctly"
|
||||
(is (= m1 (read-string (pr-str m1)))))))
|
||||
(is (= m1 (read-string (pr-str m1)))))
|
||||
(testing "Keys with value 'nil' are ignored"
|
||||
(is (= (sql/format {:select '(:a.id) :from '([:foo :a]) :group-by nil :order-by nil})
|
||||
["SELECT a.id FROM foo a"])))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue