Repository navigation
fix(jdbc): decide and pin every silent statement setter (#97) - #151
Merged
Merged
Conversation
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.
Fixes #97.
Hrana 3 is the source of truth for transport, values, metadata, batching, transactions, and error reporting.
java.sqlis the source of truth for the JDBC surface. xerial/sqlite-jdbc 3.53.4.0 is a behavioral reference, never a copy target.Decisions
setMaxRows(int)LibsqlPreparedStatement.executeQuery().getMaxRows()reads it back. Negative throwsSQLException("max row count must be >= 0").rs.maxRowsand truncates; probedsetMaxRows(2)returns 2 rows. Parity.setQueryTimeout(int)0(no limit) accepted; positive throwsSQLFeatureNotSupportedException("Query timeouts are not supported"); negative throwsSQLException.setMaxFieldSize(int)0(no limit) accepted; positive throwsSQLFeatureNotSupportedException("Column size limits are not supported"); negative throwsSQLException.setEscapeProcessing(boolean)SQLFeatureNotSupportedExceptionbefore it is sent; when off, the SQL is sent verbatim. Braces in literals, quoted identifiers, and comments do not count.setCursorName(String)SQLFeatureNotSupportedException("Cursor names are not supported").The zero-valued defaults on
setQueryTimeoutandsetMaxFieldSizeare accepted because zero means "no limit", which is exactly what the driver does. This also keeps the selected upstreamCachedRowSetTest(gh_224) green: the JDKCachedRowSetReadercallssetMaxRows(0),setMaxFieldSize(0),setQueryTimeout(0), andsetEscapeProcessing(true)on everyPreparedStatementit populates. Throwing at set time for those values would make a selected conformance test fail.Divergences
setQueryTimeoutthrows for a positive timeout instead of storing it. Honoring it needs a per-request HTTP deadline and cancel inlibsql-client, outside this PR's Files block. xerial's mapping to the SQLite busy timeout is a lock wait, not theSQLTimeoutExceptiondeadlinejava.sqldefines.setMaxFieldSizethrows for a positive limit instead of ignoring it. Column value truncation lives inLibsqlResultSet, outside this PR's Files block, and xerial's silent ignore is a bug rather than a behavior to copy.setEscapeProcessingrejects escape-bearing SQL while enabled instead of rounding. The driver has no escape translator, andjava.sqldoes not listSQLFeatureNotSupportedExceptionfor this setter, so rejecting the call itself would break generic JDBC tooling. Rejecting at execution is explicit and names the real gap.setCursorNamealways throws.java.sqlallows a no-op when positioned update/delete is unsupported, but Hrana has no positioned cursor at all, so an explicit throw is honest. Nothing in the selected conformance suite calls it.Evidence
Base
ffe6f1932aa62af1063ef5de36aaad0d278900a1, head2c301f6d4be1d80e6adb42d36db4f491ab772c7f.Red, trunk plus the new
LibsqlStatementTest:Tests run: 9, Failures: 6. The truncation test readsgetMaxRows()as 0, and the negative, query-timeout, field-size, escape-enabled, and cursor-name cases all find no exception. Logs in/tmp/xerial-parity-i97/lane-1-trunk.log.Green at head:
./mvnw -pl libsql-jdbc test -Dtest=LibsqlStatementTest: 9/9../mvnw -pl libsql-jdbc test -Dtest=LibsqlPreparedStatementTest: 8/8, including the preparedsetMaxRowslimit and escape checks../mvnw -pl libsql-jdbc test: 304/304../mvnw -pl libsql-conformance -am verify: 123 run, 0 failures, 1 skipped, BUILD SUCCESS../mvnw -pl libsql-conformance -am -Pxerial-control verify: 100 run, 0 failures, 1 skipped../mvnw spotless:check,./mvnw test, and./mvnw -pl libsql-jdbc -am package -DskipTests: BUILD SUCCESS../mvnw -pl libsql-jdbc test -Dtest='LibsqlStatement*': 33/33../mvnw -pl libsql-jdbc testwall clock, trunk median 2.65 s of three runs, head median 2.17 s, inside the ten percent rule.All lane logs are under
/tmp/xerial-parity-i97/.