Re: clojure.contrib.sql insert id

2010-04-21 Thread Joost
On Apr 21, 11:48 am, Remco van 't Veer wrote: > Nice!  That's a lot better than depending on some quirky sql construct. Agreed. There's just one potential issue (which is the same issue I have with clojure.contrib.sql): it doesn't quote the column or table names, meaning you can't use such nice c

Re: clojure.contrib.sql insert id

2010-04-21 Thread Remco van 't Veer
Nice! That's a lot better than depending on some quirky sql construct. Thanks, Remco Saul Hazledine writes: > On Apr 20, 8:51 pm, Remco van 't Veer wrote: >> I am doing the following after an insert for a Derby database: >> >>   (sql/with-query-results res >>     ["VALUES IDENTITY_VAL_LOCAL(

Re: clojure.contrib.sql insert id

2010-04-21 Thread Saul Hazledine
On Apr 20, 8:51 pm, Remco van 't Veer wrote: > I am doing the following after an insert for a Derby database: > >   (sql/with-query-results res >     ["VALUES IDENTITY_VAL_LOCAL()"] >     (first (vals (first res > > For MySQL it would be something like: > >   (sql/with-query-results res >    

Re: clojure.contrib.sql insert id

2010-04-20 Thread Remco van 't Veer
I am doing the following after an insert for a Derby database: (sql/with-query-results res ["VALUES IDENTITY_VAL_LOCAL()"] (first (vals (first res For MySQL it would be something like: (sql/with-query-results res ["SELECT LAST_INSERT_ID()"] (first (vals (first res I

clojure.contrib.sql insert id

2010-04-20 Thread Saul Hazledine
Hello, I'm using clojure.contrib.sql/insert-records to add data to a database. I've hit a problem where I am unable to get the autogenerated IDs of the records that I have inserted. I believe in JDBC this is normally done with statement_handle.getGeneratedKeys(). Unfortunately, as far as I can s