Repository navigation
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 CASCADEnow deletes child rows, and inserting a row whose parent does not exist now fails. Ajdbc:URL's ownforeign_keysparameter still takes precedence. - A
begin()inside a transaction is a savepoint on every driver. The JVM PostgreSQL and MySQL drivers used to send a secondBEGIN, 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:
YEARandBITvalues 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) andllms.txtto 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 isnull(it used to run an UPDATE that matched nothing). Properties namedsqlorstatementare bound correctly.@Queryparameters are checked by the rules of each dialect. Projections are checked by their column aliases. - Cancellation: a cancelled
acquire()orbegin()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_ESCAPESsessions. - 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
COMMITrolls back. Generated ids are reported correctly for UPSERTs and for a rowid of 0. - Android SQLite:
ATTACHand DDL statements work. Every statement in a multi-statement string runs, and its rows are counted.replace()is no longer confused with aREPLACEstatement. - 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.