Repository navigation
fix(jdbc): fold transaction modes and table types with Locale.ROOT - #288
Merged
Merged
Conversation
TransactionMode.from and MetadataSql.tables called toUpperCase without a locale. Under a Turkish default locale, "immediate" folded to "İMMEDİATE" and the VIEW table-type literal to "VİEW", so the mode lookup threw and the getTables filter matched nothing. Use Locale.ROOT at both sites, matching the policy of the rest of the driver. Pin both call sites with Turkish-default tests, and switch the foreign-key locale pin to "restrict" so it is mutation-sensitive. Closes #286
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.
Description
TransactionMode.fromandMetadataSql.tablescalledtoUpperCase()without a locale. Under a Turkish default locale,"immediate"folded to"İMMEDİATE", soTransactionMode.from("immediate")threwIllegalArgumentException, and theVIEWtable-type filter folded to"VİEW", sogetTables(..., new String[] {"VIEW"})matched nothing.Both sites now use
Locale.ROOT, matching the policy the rest of the driver adopted in #283.Call sites
libsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/LibsqlConnection.javaTransactionMode.fromlibsql-jdbc/src/main/java/io/github/magnusp/libsql/jdbc/MetadataSql.javatablesTests
transactionModeFoldsUnderATurkishDefaultLocalesetsLocale.forLanguageTag("tr")and assertsTransactionMode.from("immediate")isIMMEDIATEandfrom("exclusive")isEXCLUSIVE.tableTypeFilterFoldsUnderATurkishDefaultLocalebuilds the predicate with{"table", "view"}under the same default and assertsAND TABLE_TYPE IN ('TABLE','VIEW').restrictinstead ofset null, so it is mutation-sensitive too (set nullandcascadecontain no Turkish-sensitive letter). Theset nullmapping stays covered byLibsqlDatabaseMetaDataTest.getImportedKeysMapsForeignKeyRowsAndNames.Both new tests fail before the fix and pass after it. Before the fix, the transaction-mode test fails with
No enum constant ...İMMEDİATE, and the table-type test fails on theVİEWliteral. Reverting theForeignKeyMetadatacall site to the default locale makes the strengthened FK pin fail.No public API, exception type, or message changed.
Locale.ROOTandLocale.ENGLISHfold identically for these inputs, as probed in #285.Type of Change
Checklist
./mvnw spotless:check)../mvnw -pl libsql-jdbc -am test: 1622 tests, 0 failures). The container lane runs in CI.Fixes #286