Permalink
Browse files

Fix silent dropping of raw string predicates introduced in 4d323eb.

  • Loading branch information...
lynaghk committed Aug 24, 2011
1 parent 4d323eb commit b20b75b3aaa20d4d7252b9736860e5ecbc5d3419
Showing with 9 additions and 1 deletion.
  1. +3 −1 src/clojureql/predicates.clj
  2. +6 −0 test/clojureql/test/core.clj
@@ -121,7 +121,9 @@
(predicate
(map #(if (qualify? %) (str (to-tablealias (:tname this))
\. %) %)
- (flatten stmt))
+ (if (string? pred)
+ [pred]
+ (flatten stmt)))
env
cols)))
@@ -150,6 +150,12 @@
(select (where (= :title "Developer"))))
"SELECT users.* FROM users WHERE (users.id = 5) AND (users.title = Developer)"))
+ (testing "String predicates"
+ (are [x y] (= (-> x (compile nil) interpolate-sql) y)
+ (-> (table :users)
+ (select "name = 'Frank'"))
+ "SELECT users.* FROM users WHERE name = 'Frank'"))
+
(testing "projections"
(are [x y] (= (-> x (compile nil) interpolate-sql) y)
(-> (table :users)

0 comments on commit b20b75b

Please sign in to comment.