-
Notifications
You must be signed in to change notification settings - Fork 627
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
feat(jdbc): reintroduce improved support for Statement#getGeneratedKeys #1035
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds back support for the getGeneratedKeys functionality previously removed in commit 332edfb. The new implementation attaches the generated keys directly to the Statement so that it is safe to use in an interleaved manner and accross threads. This does not address tracking inserts of multiple values in the same statement (#468) but that functionality was never previously available. It could potentially be added in future enhancements. Resolves: #329, #963, #965, #980, #1018, #1028
Hi @gotson - just checking in - do you have any thoughts about this PR? |
I didn't had time to look at it yet, but will do in January. |
gotson
reviewed
Jan 16, 2024
seems like code formatting failed, could you run |
all set, code formatting should be good now! |
Thanks a lot for the quality PR! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @gotson,
Over in #1018 (comment) you mentioned that you'd be willing to look at a PR that restores getGeneratedKeys functionality if it could resolve the safety issues originally reported in #329.
This PR seeks to do that by adding back support for Statement#getGeneratedKeys with a new implementation that tightly scopes the generated keys to the Statement object. This makes it safe to use in an interleaved manner, across threads, and with multiple Statements.
In the interest of transparency, this PR does not address tracking keys for multiple inserts on the same statement (#468). However, that functionality was never previously available. That it could potentially be added in future enhancements to this model if it became a requirement.
Restoring this functionality would be a huge benefit to the users of this JDBC driver. Many applications and integrations were adversely affected by the removal of the basic getGeneratedKeys functionality that they came to depend on it over the past 16 years. This PR should restore the core functionality with critical improvements to scope and safety.
Please let me know if you have any questions or suggestions for improvements. Thank you for your consideration.