Skip to content
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
merged 4 commits into from
Jan 19, 2024
Merged

feat(jdbc): reintroduce improved support for Statement#getGeneratedKeys #1035

merged 4 commits into from
Jan 19, 2024

Conversation

sjlombardo
Copy link
Contributor

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.

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
@sjlombardo
Copy link
Contributor Author

Hi @gotson - just checking in - do you have any thoughts about this PR?

@gotson
Copy link
Collaborator

gotson commented Dec 21, 2023

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 gotson self-requested a review January 12, 2024 07:04
@gotson gotson self-assigned this Jan 12, 2024
@gotson
Copy link
Collaborator

gotson commented Jan 18, 2024

seems like code formatting failed, could you run mvn spotless:apply ?

@sjlombardo
Copy link
Contributor Author

all set, code formatting should be good now!

@gotson
Copy link
Collaborator

gotson commented Jan 19, 2024

Thanks a lot for the quality PR!

@gotson gotson changed the title fix(jdbc): reintroduce improved support for Statement#getGeneratedKeys feat(jdbc): reintroduce improved support for Statement#getGeneratedKeys Jan 19, 2024
@gotson gotson merged commit f7d49f6 into xerial:master Jan 19, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants