LauJensen / clojureql

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

transforms and pick bug #109

Closed kirasystems closed 12 years ago

kirasystems commented 12 years ago

The new transforms feature contains a bug. The easiest way to see it is to try:

(pick (table :mytable) :id) 

where id is an integer. You will get an error about creating an ISeq from java.lang.Integer. Problem stems from how transforms are applied to the final query. Specifically, in this code

 (deref [this]
    (apply-on this doall))

  Relation
  (apply-on [this f]
    (with-cnx cnx
      (with-results* (compile this cnx)
        (fn [results]
          (f (if transform
               (transform results)
               results))))))

The function f is doall and you cannot apply this to things like integers or timestamps. I did not submit a patch as I don't know what the intention here is. I would guess that you want to perform the doall before the transform, but perhaps this would break how you use the apply-on function elsewhere.

bendlas commented 12 years ago

Thanks for the report