Repository navigation
fix(jdbc): throw SQLFeatureNotSupportedException and implement stream getters - #146
Merged
Merged
Conversation
… getters Replace the remaining UnsupportedOperationException paths in LibsqlResultSet and LibsqlDatabaseMetaData with SQLFeatureNotSupportedException, implement getBinaryStream/getCharacterStream and the read-only getBlob/getClob surface, reject non-empty type maps in getObject(Map), and reject a null findColumn label with SQLException.
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 #114
Closes #27
Contract
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 is a behavioral reference and conformance foundation, never a copy target.Protocol basis:
Value.Blobis base64 on the wire, so streams and blobs materialize locally from the decoded bytes. Unsupported optional features throwSQLFeatureNotSupportedExceptionper JDBC.What changed
LibsqlResultSet: every remainingUnsupportedOperationExceptionreplaced withSQLFeatureNotSupportedException(allupdate*,getRef,getArray,getURL,getRowId,getNClob,getSQLXML,getAsciiStream,getUnicodeStream,getNCharacterStream).getBinaryStream(int/String)overgetBytesandgetCharacterStream(int/String)overgetString; SQL NULL returns null.getBlob(int/String)andgetClob(int/String)over the materialized value, with the full read side ofjava.sql.Blob/Clob; write methods throwSQLFeatureNotSupportedException.getObject(int, Map)andgetObject(String, Map)reject a non-empty map withSQLFeatureNotSupportedException("Type maps are not supported"); null and empty maps keep the existing behavior.findColumn(null)throwsSQLException("column label cannot be null")instead ofNullPointerException.LibsqlDatabaseMetaData: 14 unsupported metadata methods now throwSQLFeatureNotSupportedException.#27 answer
Read side supported:
getBlob/getCloband the full read surface ofBlob/Clob(length,getBytes/getSubString, streams, position, free), plusgetBinaryStreamandgetCharacterStream.Write side not supported:
PreparedStatement.setBlob/setCloband theBlob/Clobmutators are outside this PR's Files block and still throwSQLFeatureNotSupportedException.getAsciiStream,getUnicodeStream, andgetNCharacterStreamalso remain unsupported (see divergences).Divergences
getAsciiStream,getUnicodeStream, andgetNCharacterStream; this PR leaves them unsupported because the plan's Build limits stream implementation togetBinaryStreamandgetCharacterStream. They now throw the checked JDBC exception, socatch (SQLException)callers survive.getBlob; this driver implements it because Hrana already carries the decoded blob bytes and [Bug]: check for BLOB support #27 asks for blob support. It is read-only.getObject(Map)unconditionally; this driver accepts null and empty maps and rejects only a non-empty map, matching fix(jdbc): reject unsupported type maps and report holdability #95'ssetTypeMapcontract.Evidence
Red (trunk
1c240cdwith these test files,/tmp/xerial-parity-i114/lane-1-regression.log): 67 tests, 4 failures and 4 errors. The new stream, blob, map, findColumn, and sweep cases fail onUnsupportedOperationException, the ignored type map, and the null-label NPE.Green (head
47ea3f2, same log): 67 tests, 0 failures, BUILD SUCCESS.Lanes (logs under
/tmp/xerial-parity-i114/):UnsupportedOperationException../mvnw -pl libsql-jdbc test: 273 tests, BUILD SUCCESS../mvnw -pl libsql-conformance -am verify: 123 tests, 1 skipped, BUILD SUCCESS, no new divergence../mvnw -pl libsql-conformance -am -Pxerial-control verify: 100 tests, 1 skipped, BUILD SUCCESS../mvnw spotless:check: BUILD SUCCESS../mvnw test: BUILD SUCCESS.lane-9-specific.log../mvnw -pl libsql-jdbc -am package -DskipTests: jar built.Perf:
./mvnw -pl libsql-jdbc testmedians over three interleaved runs, trunk 2.159 s versus head 2.167 s, +0.4 percent, within the 10 percent rule.Files touched: only the four files in the plan's Files block. Base
1c240cd, head47ea3f2.