Repository navigation
fix(jdbc): honor the supplied Calendar in date/time overloads - #260
Merged
Merged
Conversation
magnusp
force-pushed
the
fix/i237-honor-calendar
branch
from
October 30, 2026 23:31
eb0afff to
6570295
Compare
magnusp
force-pushed
the
fix/i237-honor-calendar
branch
from
October 30, 2026 23:33
6570295 to
cb8da85
Compare
magnusp
force-pushed
the
fix/i237-honor-calendar
branch
from
October 30, 2026 23:42
cb8da85 to
5a22b79
Compare
magnusp
force-pushed
the
fix/i237-honor-calendar
branch
from
October 30, 2026 23:48
5a22b79 to
76c8765
Compare
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.
Why
The nine
Calendaroverloads ofsetDate/setTime/setTimestampandgetDate/getTime/getTimestampignored theirCalendarand delegated to the default-zone overload. A caller passingAsia/Tokyogot the same text and the same instant as a caller passingUTC, which contradicts JDBC, H2, PostgreSQL, and xerial.What changed
ZoneIdthroughSqliteDateTimeValues.from,epochMillisToLocalDateTime, andparseSqliteDateTime, keeping the system-default overloads so the non-Calendar path is unchanged. Text with an explicit offset is a fixed instant converted into the zone; naive text is wall-clock time in the zone; INTEGER is epoch millis; FLOAT is a Julian day.java.sql.Date/Time/Timestampfrom the zone-local fields: midnight of the local date,1970-01-01plus the local time, and the full local date-time with nanos preserved.yyyy-MM-dd,HH:mm:ss, andyyyy-MM-dd HH:mm:ss[.fraction]with.0for zero nanos, matchingTimestamp.toString().setTimestampdoes not go throughJdbcValueConverter.formatTimestamp.Calendarmeans the JVM default zone and delegates to the existing overload; it never throws.Blast radius
Only the nine Calendar overloads change. The default-zone overloads,
setObject,getObject(..., LocalDate.class), and the Appendix B conversion paths are untouched, so existing text and instants are unchanged. ATimestampstill carries no zone: the calendar only decides which instant naive stored text denotes.Verification
./mvnw -pl libsql-jdbc -Dtest='LibsqlResultSetTest,LibsqlPreparedStatementTest' test: 99 tests, 0 failures../mvnw clean verify: 1524 JDBC unit tests (1559 unit tests across the reactor), 192 itests, 271 conformance tests with 7 skipped, 0 failures. This includes the vendoredStatementTest#nullDateand#emptyDate../mvnw spotless:checkpasses.Fixes #237