LauJensen / clojureql

ClojureQL is superior SQL integration for Clojure
https://clojureql.sabrecms.com
Eclipse Public License 1.0
285 stars 39 forks source link

where and restrict cause problems: #119

Closed Licenser closed 12 years ago

Licenser commented 12 years ago

The follwogin example

(->
   (cql/table 1 :t)
   (cql/select 
    (cql/where (and
        (cqlp/restrict "a = 1")
        (cqlp/restrict "b = 2")))))

results in the query:

SELECT t.* FROM t WHERE a = 1b = 2

The hand is not recognized for some reason. And yes I know there is (= :a 1) this is just a simplified example of the error to reproduce.

LauJensen commented 12 years ago

restrict is deprecated, use where instead.

user> (cql/select (cql/table :tst) (cql/where (and (= :a 1) (= :b 2)))) SELECT tst.* FROM tst WHERE ((tst.a = 1) AND (tst.b = 2))

Licenser commented 12 years ago

The core problem was that for some queries the only ay was to use restrict but I don't have the actual code any more since I buoil the query by hand now.

LauJensen commented 12 years ago

You're welcome to paste the query in here