Silly question, but which version of java.jdbc are you using? Up until 0.0.3 I had no end of troubles with psql because of the batchExecute issue.

Cheers,

Aaron Bedra
--
Clojure/core
http://clojure.com

On 07/11/2011 02:48 AM, Brian Carper wrote:
On Jul 10, 4:52 pm, Wilfred<yowilf...@gmail.com>  wrote:
I'm at a bit of a loss. "UPDATE comments SET approved='1' WHERE id =
'1'" works fine in psql. approved is a boolean field, so is this an
issue with the SQL library producing incorrect SQL?
I think this is an oddity with the JDBC driver for PostgreSQL.  The
driver doesn't seem to like doing automatic typecasting.  Try this:

(sql/update-values :comments
                    ["id = cast(? as integer)" id]
                    ;; alternatively "id = ?::integer"
                    {:approved true})

Or you could (Integer/parseInt id) to do the cast before you pass it
as parameter, though in either case you should validate your id before
casting, if you want to avoid dying on poorly-formed input.

--
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

Reply via email to