Handle empty :where SQL clauses in query.

This commit is contained in:
Nick Alexander 2016-07-15 12:42:20 -07:00 committed by Richard Newman
parent 13dc1cc9b6
commit 4262b10f55

View file

@ -170,11 +170,12 @@
[(map row columns-in-order) nil]))))) [(map row columns-in-order) nil])))))
(defn context->sql-clause [context] (defn context->sql-clause [context]
(merge
{:select (sql-projection context) {:select (sql-projection context)
:from (:from context) :from (:from context)}
:where (if (empty? (:wheres context)) (if (empty? (:wheres context))
nil {}
(cons :and (:wheres context)))}) {:where (cons :and (:wheres context))})))
(defn context->sql-string [context] (defn context->sql-string [context]
(-> (->