Skip to content

1.18.0

Latest

Choose a tag to compare

@smyrgeorge smyrgeorge released this 01 Nov 15:43
· 12 commits to main since this release

sqlx4k 1.18.0

A consistency release: every driver now behaves the same way for foreign keys, nested transactions and cancellation. It brings 40+ fixes across the drivers and the code generator, a new documentation site with the API reference, and an agent skill for using sqlx4k with AI coding assistants.

⚠️ Before upgrading

  • SQLite foreign keys are now enforced on the JVM and Android, as they already were on native. ON DELETE CASCADE now deletes child rows, and inserting a row whose parent does not exist now fails. A jdbc: URL's own foreign_keys parameter still takes precedence.
  • A begin() inside a transaction is a savepoint on every driver. The JVM PostgreSQL and MySQL drivers used to send a second BEGIN, so a nested commit committed the outer transaction.
  • Committing a transaction while a nested one is still open now rolls it back instead of reporting success.
  • Android: committing a transaction that a nested one was rolled back in now fails.
  • Code generation: only the properties declared in an entity's primary constructor are columns. Properties declared in the class body are no longer written by the generated INSERT and UPDATE.
  • MySQL: YEAR and BIT values are read as numbers (2024, 1), not as raw bytes.

✨ Highlights

  • New documentation site with guides, a Repositories page and the Dokka API reference, deployed with each release.
  • Agent skill (skills/sqlx4k) and llms.txt to help AI coding assistants use sqlx4k correctly.
  • The same transaction, savepoint and foreign-key behaviour on native, JVM and Android.

🐛 Fixes (selection)

  • Code generator: save() inserts an entity whose nullable id is null (it used to run an UPDATE that matched nothing). Properties named sql or statement are bound correctly. @Query parameters are checked by the rules of each dialect. Projections are checked by their column aliases.
  • Cancellation: a cancelled acquire() or begin() gives its connection or transaction back, on native, JVM SQLite and Android.
  • Native PostgreSQL: binary values of every type are decoded. A stream gives its connection back once it ends. Stream chunks end at statement boundaries.
  • Native MySQL: multiple result sets are kept apart and read through to the end. Streams stop only between rows. A row is visible in the transaction that wrote it.
  • JVM MySQL: a statement without parameters runs as written, which fixes NO_BACKSLASH_ESCAPES sessions.
  • SQLite and SQLCipher: opening a file that is not a database, or using a wrong key, fails at once. A passphrase that contains NUL is rejected. A failed COMMIT rolls back. Generated ids are reported correctly for UPSERTs and for a rowid of 0.
  • Android SQLite: ATTACH and DDL statements work. Every statement in a multi-statement string runs, and its rows are counted. replace() is no longer confused with a REPLACE statement.
  • Native drivers: an unknown parameter kind returns an error instead of aborting the process.
  • The status of connections and transactions is read safely from any thread.

Full list of changes: 1.17.0...1.18.0

Migrations

✅ No database migrations required.