Skip to content

feat(jdbc): report live SQLite version from sqld via sqlite_version() - #21

Merged
magnusp merged 1 commit into
mainfrom
feat/jdbc-live-sqlite-version
Oct 4, 2026
Merged

magnusp merged 1 commit into
mainfrom
feat/jdbc-live-sqlite-version

Conversation

@magnusp

@magnusp magnusp commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Summary

Previously getDatabaseProductVersion(), getDatabaseMajorVersion(), and getDatabaseMinorVersion() in LibsqlDatabaseMetaData returned hardcoded values ("3.0", 3, 0), regardless of the actual SQLite version running inside the connected sqld instance.

Changes

  • Added a private resolveDatabaseProductVersion() helper that lazily executes SELECT sqlite_version() against the server on first call and caches the result on the metadata object.
  • getDatabaseProductVersion() now returns the real version string (e.g. "3.46.1").
  • getDatabaseMajorVersion() / getDatabaseMinorVersion() parse their respective components from that string.
  • A safe fallback to "3.0" / 3 / 0 is retained if the query fails for any reason.

Testing

  • spotless:apply applied; spotless:check passes.
  • mvnw test -pl libsql-jdbc passes.

Previously getDatabaseProductVersion(), getDatabaseMajorVersion(), and
getDatabaseMinorVersion() in LibsqlDatabaseMetaData returned hardcoded
values ("3.0", 3, 0). They now lazily execute SELECT sqlite_version()
against the connected sqld instance on first call, cache the result, and
parse major/minor components from the version string (e.g. "3.46.1").
A fallback to "3.0" is retained in case the query fails.
@magnusp
magnusp merged commit 46a039a into main Oct 4, 2026
5 checks passed
@magnusp
magnusp deleted the feat/jdbc-live-sqlite-version branch October 4, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant