Repository navigation
Commit 1bed15e
authored
fix(jdbc): treat non-ASCII characters as identifier characters (#137)
Fixes #103.
Contract: Hrana 3 is the source of truth for transport, values,
metadata, batching, transactions, and error reporting. `java.sql` is the
source of truth for the JDBC surface. xerial/sqlite-jdbc is a behavioral
reference and conformance foundation, never a copy target.
## Change
`isWordChar` in `SqlTableReference` and `LibsqlResultSetMetaData` now
treats every character at or above `0x80` as an identifier character,
matching SQLite. `SqlTableReference.UNQUOTED_IDENTIFIER` accepts the
same range, because `identifierOf` re-validates word tokens against that
pattern; without it the tokenizer would still split `användare`.
ASCII-only behavior is unchanged.
Base `aad9c7e456fad5c874e8efdc6f6c2d368244b654`, head
`c47144e6935ed9b145cf2e58eca7dfd39387d526`.
## Red and green
- Red at trunk code with the new tests: 7 failures, `Tests run: 66,
Failures: 7` (`/tmp/xerial-parity-i103/lane-1-regression.log`).
`SqlTableReferenceTest.resolvesNonAsciiTableAndColumn` got `[null]`
instead of `användare`;
`LibsqlResultSetMetaDataTest.resolvesNonAsciiTableName` got an empty
table name.
- Green at head: `SqlTableReferenceTest` 34/34,
`LibsqlResultSetMetaDataTest` 32/32, BUILD SUCCESS.
## Lanes
| Lane | Command | Result |
| --- | --- | --- |
| 1 | targeted tests at trunk vs head | red 7 failures, green 66/66 |
| 2 | `LibsqlResultSetMetaDataTest` | 32/32; `getTableName` returns
`användare` |
| 3 | non-ASCII table + `anv` shadow (`LibsqlResultSetMetaDataTest`,
prefix case) | 32/32; reports `användare`, not `anv` |
| 4 | `./mvnw -pl libsql-jdbc test` | 245/245, BUILD SUCCESS |
| 5 | `./mvnw -pl libsql-conformance -am verify` | 123 tests, 0
failures, 1 skipped, BUILD SUCCESS |
| 6 | `./mvnw -pl libsql-conformance -am -Pxerial-control verify` | 100
tests, 0 failures, 1 skipped, BUILD SUCCESS |
| 7 | `./mvnw spotless:check` | BUILD SUCCESS |
| 8 | `./mvnw test` | BUILD SUCCESS |
| 9 | parser/result-set suite (98 tests) | BUILD SUCCESS; no ASCII case
changed outcome |
| 10 | `./mvnw -pl libsql-jdbc -am package -DskipTests` | BUILD SUCCESS;
jar and shaded jar built |
Perf: `./mvnw -pl libsql-jdbc test` medians, three interleaved runs per
side: trunk 2.08 s, head 2.08 s (within 10%). Logs in
`/tmp/xerial-parity-i103/`.
## Divergences
- `UNQUOTED_IDENTIFIER` gained the `\x80-\uFFFF` range. The plan's Build
box names only `isWordChar`, but `identifierOf` rejects any word token
outside that pattern, so the tokenizer fix alone cannot make `användare`
resolve.
- `LibsqlResultSetMetaDataTest` is not in the Files block; lane 2 names
it explicitly, so the two metadata cases live there.
- `resolvesQuotedNonAsciiNames` mixes quoted names with an unquoted
non-ASCII column, so it fails at trunk as lane 1 requires. The fully
quoted assertion (`SELECT "namn_ö" FROM "användare"`) already passed at
trunk and is kept as regression coverage only.
Tests added: non-ASCII tables, columns, table/column aliases, quoted and
bracketed names, `SELECT *` expansion, a table named `anv` shadowing
`användare`, and the metadata path.1 parent aad9c7e commit 1bed15e
4 files changed
Lines changed: 122 additions & 4 deletions
File tree
- libsql-jdbc/src
- main/java/com/github/magnusp/libsql/jdbc
- test/java/com/github/magnusp/libsql/jdbc
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
762 | 762 | | |
763 | 763 | | |
764 | 764 | | |
765 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
766 | 771 | | |
767 | 772 | | |
768 | 773 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
1273 | 1274 | | |
1274 | 1275 | | |
1275 | 1276 | | |
1276 | | - | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1277 | 1283 | | |
1278 | 1284 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
57 | 81 | | |
58 | 82 | | |
59 | 83 | | |
| |||
644 | 668 | | |
645 | 669 | | |
646 | 670 | | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
647 | 698 | | |
648 | 699 | | |
649 | 700 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
61 | 117 | | |
62 | 118 | | |
63 | 119 | | |
| |||
0 commit comments