Add support for JDBC drivers which don't support generated keys #108

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants
Contributor

andeee commented Sep 1, 2011

  • Not every JDBC driver does support getGeneratedKeys, in my example Sybase SQL Anywhere doesn't support it and throws an SQLException when e. g. trying to conj! onto a table
  • We can make clojureql work with these drivers when calling supportsGetGeneratedKeys onto DatabaseMetaData before we create the statement and append the generated keys to the result
  • I also check for the corner case when supportsGetGeneratedKeys isn't even implemented, catching the AbstractMethodError.
    Support for generated keys was introduced with JDBC Version 3, so here we could start to support even older drivers - tested with a SQL Anywhere JDBC Driver Version 9 which only supports JDBC Version 2

Andreas Wurzer added some commits Sep 1, 2011

Andreas Wurzer
added supports-get-generated-keys? (wrapper for DatabaseMetaData.supp…
…ortsGetGeneratedKeys)

added generated-keys, prepare-statement
fixed tests for derby database
Contributor

andeee commented Sep 1, 2011

follow up from #107

Collaborator

bendlas commented Sep 2, 2011

Committed. Thanks a lot for your help!

@bendlas bendlas closed this Sep 2, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment