Repository navigation
refactor(jdbc): extract generated-key state - #281
Merged
Merged
Conversation
magnusp
force-pushed
the
refactor/generated-keys
branch
from
October 31, 2026 10:47
802e406 to
cbadecd
Compare
This file contains hidden or 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
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.
What changed
Moved the generated-key state out of
LibsqlStatementinto a package-privateGeneratedKeys. The statement keeps its three entry points (updateGeneratedKeys,clearGeneratedKeys, andgetGeneratedKeys) and itsstateLock.GeneratedKeysowns the insert detection, the single and batch result shaping, and the close-on-clear rule.The batch call now runs directly under the
stateLockthatexecuteBatchalready holds, so the private wrapper disappeared.Behavior preserved
The generated-key column labels stay
last_insert_rowid()and1. Single and batch keys keep their order and values. A non-insert step contributes no key. Every exception type and message is unchanged. The public and protected statement methods are unchanged. The public API is unchanged.Pins added
emptyGeneratedKeysUseTheXerialColumnName1.mixedBatchReportsOnlyTheInsertStepKeysMutant kills
1to0.Diff (file statistics)
Line counts
LibsqlStatement.javaGeneratedKeys.javaProbe
The first probe renamed the empty generated-key column, and the column-name pin failed. The second probe removed the insert-only filter from the batch path, and the mixed-batch pin failed. Both probes were reverted before the final lane run.
Lanes
mise exec -- ./mvnw -pl libsql-jdbc -am testmise exec -- ./mvnw spotless:checkmise exec -- ./mvnw -pl libsql-conformance -am verifyDOCKER_CONFIG=... mise exec -- ./mvnw -pl libsql-itests -am verify./mvnw spotless:check)../mvnw clean verify).Closes #280