Repository navigation
fix(jdbc): read date and time getters by SQLite storage class - #136
Merged
Merged
Conversation
INTEGER is epoch milliseconds, FLOAT is a Julian day, and TEXT uses SQLite date and time formats. All java.sql and java.time targets now share the same storage-class conversion, and the #69 conversion table documents the SQLite conventions.
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 #102
Contract: Hrana 3 carries only INTEGER, FLOAT, TEXT, and BLOB, so date/time meaning is a local SQLite convention;
java.sqldefines the getter surface; sqlite-jdbc is the behavioral reference, not the contract.Base:
168f69aff4cebe175699bf5b421decf6a49c3b09Head:
fb993bd06de73bef417193faa803949cd24fe8e8What changed
getDate,getTime, andgetTimestampnow switch on theValuestorage class instead of parsinggetString():yyyy-MM-dd HH:mm:ss.SSS, bare dates, bare times, optional fractional digits, and an optional time-zone suffix.Bad value for type <target>; NULL:null.LocalDate,LocalTime, andLocalDateTimeare built from the same storage-class result, sogetObject(column, X.class)agrees with the correspondingjava.sqlgetter. The #69 conversion table now documents these SQLite conventions instead of text parsing.Evidence
./mvnw -pl libsql-jdbc test -Dtest=LibsqlResultSetTestat base + new tests -> 3 failures, all new cases (/tmp/xerial-parity-i102/lane-1-regression.log).LibsqlResultSetGetObjectTest-> 43 tests, 0 failures (/tmp/xerial-parity-i102/green-unit.log).2024-01-02 10:00:00and INTEGER1700000000000pass (lane-2-specific.log); xerial reference probe output recorded inreference-probe.log(TEXT -> 2024-01-02; INTEGER -> 2023-11-14 in Europe/Stockholm).lane-3-specific.log).lane-4-module-suite.log).lane-5-conformance.log).lane-6-control.log).lane-7-spotless.log).lane-8-reactor.log).LibsqlResultSet*: 116 tests, 0 failures (lane-9-specific.log).lane-10-package.log)../mvnw -pl libsql-jdbc test3x interleaved. Trunk median 2.12 s, head median 2.15 s, +1.4% (within 10%).Divergences
unixepochseconds. sqlite-jdbc's defaultdate_precisionis MILLISECONDS, and the issue's1700000000000case requires it.getDate/LocalDatereturn that date where xerial throws. This follows SQLite's time-value rule.Bad valueinstead of xerial's numeric fallback; BLOB is not a SQLite datetime storage class.getTimereturns a time-of-day, soTimedoes not carry the source date as xerial's TEXT path does. JDBC definesgetTimeas the time component.