-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getGeneratedKeys() is deprecated #980
Comments
Or you can use RETURNING clauses, see #963 also |
Well The specification even goes as far to say "If the columns which represent the auto-generated keys were not specified, the JDBC driver implementation will determine the columns which best represent the auto-generated keys." meaning that the driver needs to absolutely make sure to return something here if it's even closely possible, no matter if it's a good idea or not. |
https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#supportsGetGeneratedKeys-- seem to indicate otherwise. In addition, the link you mentioned explicitly says :
|
But if SQLite supports that functionality, why would a driver not support it? The link I provided also says:
Which indicates that a best-effort approach here is fine and that anyone using the API should not expect it to be 100% accurate. Hence I don't see the need to remove that. If anything the shortcomings in the driver should be documented, not important functionality removed. |
Basic support means it should return keys for all the rows inserted, which sqlite cannot do. At best it can only get the ID of a single row. |
See #329 for explanations on previous behavior and its shortcomings. |
I'm just trying to use this JDBC driver from Adobe ColdFusion. I set up a datasource and now wanted to find out how I insert into a database and retrieve a value from an autoincrement column.
I looked into your jar file and see
getGeneratedKeys()
is deprecated.There's the comment
There was this question on StackOverflow.
https://stackoverflow.com/questions/64901198/missing-generatedkey-from-query-result
A comment says ColdFusion calls this function, so it can return the value of the autoincrement column, automatically.
So I guess to retrieve the generated value I have to call
SELECT last_insert_rowid()
, manually.Can you confirm?
The text was updated successfully, but these errors were encountered: