Dear fellow clojurians,

The following behaviour seems (to me) rather odd.

This succeeds:

    gocatch.job.job> (clojure.java.jdbc/query *database* ["select * from 
Job where id = ?" (long 90)])
    ({:tip 200,
      :vehicle-type "TAXI",
      :passenger-id "43a4a489e18e09cade321fc6d5b7817f63293e58",
      :creation-time #inst "2015-05-04T20:04:41.000000000-00:00",
      :id 90})

But this fails:
    gocatch.job.job> (clojure.java.jdbc/query *database* ["select * from 
Job where id = ?" (bigint 90)])
    ()

Apparently, someone in the chain between clojure.java.jdbc downwards 
doesn't realize that
bigints are integers.

My _guess_ is the problem is in this protocol, in jdbc.clj (version 0.3.6)

    (extend-protocol ISQLValue
      Object
      (sql-value [v] v)

      nil
      (sql-value [_] nil))

Which thinks an SQL value is the same as a lisp value.  I was naïvely 
expecting
to see a bunch of clauses for floats, rationals, etc in there.

Anyway, if I try something like this:
    (extend-protocol ISQLValue
      clojure.lang.BigInt
      (sql-value [v] (str v))

      Object
      (sql-value [v] v)

      nil
      (sql-value [_] nil))

it fixes my problem.  Anybody know if I'm on the right track?


             Alain Picard
        


p.s. posting here because I can't find a publically available way to post 
bugs
to the clojure.java.jdbc project.



-- 
 <http://www.gocatch.com/>
  Sydney, Australia

  <https://www.facebook.com/goCatch>  <https://twitter.com/gocatchapp>  
<http://www.linkedin.com/company/goCatch>   
<https://itunes.apple.com/au/app/gocatch/id444439909?mt=8>  
<https://play.google.com/store/apps/details?id=com.gocatchapp.goCatch&hl=en>
 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to