On Jul 20, 4:15 pm, Mark Nutter <manutte...@gmail.com> wrote:
> > * Add support for databases that cannot return generated keys (e.g., HSQLDB)
> >  - insert operations silently return the insert counts instead of
> > generated keys
> >  - it is the user's responsibility to handle this if you're using
> > such a database!
>
> If I'm understanding this correctly, this means that inserting 4 rows
> will return "4" instead of a list of 4 generated keys, is that right?
> If so, what would you think about having it return a list of 4 zeroes
> instead? It would still be up to the user to handle the zero as a
> special case, but the structure would be more parallel with other db's
> results, and you could test based on the "key" itself instead of
> having to refer to some global *db-type* var for your if statement.

JDBC Batch-insert is not supposed to return a list of generated keys.
It is actually database dependent -- e.g. MySQL returns a list of
generated keys, whereas another DB (e.g. PostgreSQL) may not.

It is possible to implement batch-insert as a series of individual
insert statements, so that you can collect the generated key after
each operation and eventually return a collection of generated keys.

Regards,
Shantanu

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