v0.5.0
[0.5.0] - 2026-03-16
Major feature release. Substantial surface added; several subtle
behavioral changes worth noting on upgrade.
Added
- Online backup API.
XqliteNIF.backup/2+restore/2(one-shot),
plusbackup_with_progress/6(page-by-page with progress messages to
a PID, cancel-token support). - Session extension.
session_new,session_attach,session_changeset,
session_delete,changeset_invert,changeset_concat,
changeset_applywith conflict strategies (:omit,:replace,
:abort). - Incremental blob I/O.
blob_open,blob_read,blob_write,
blob_close. Read and write multi-GB column values without loading
them into memory. - Extension loading.
enable_load_extension/2and
load_extension/2,3. Opt-in; disabled by default. - Serialize / deserialize.
serialize/1captures the entire live
database as a single binary byte-for-byte identical to its on-disk
form;deserialize/2loads it back. - Log hook and update hook via raw
enif_send. Per-connection
update notifications as{:xqlite_update, action, db, table, rowid};
global log hook as{:xqlite_log, code, message}. - Type extension behaviour.
Xqlite.TypeExtensionfor bidirectional
Elixir↔SQLite conversion. Built-ins shipped forDateTime,Date,
Time,NaiveDateTime. Xqlite.Resultstruct implementing theTable.Readerprotocol —
consumable directly by Explorer, Kino, VegaLite.XqliteNIF.transaction_status/1— structured query of the
current connection's transaction state.- Read-only opens.
open_readonly/1andopen_in_memory_readonly/1. - Transaction modes.
deferred,immediate,exclusive. - Schema-prefixed PRAGMAs.
:db_nameoption for PRAGMAs that accept
a database name parameter.
Changed
- PRAGMA schema reworked from a keyword list to
Xqlite.PragmaSpec
structs. Public shape change for anyone introspecting PRAGMA
metadata. - PRAGMA SET now returns the echoed value instead of discarding it,
matching the{:ok, echoed_value}shape of the rest of the API. XqliteNIF.close/1eagerly releases the underlying SQLite
connection rather than waiting for Elixir GC.- rusqlite upgraded 0.38 → 0.39. UTF-8 errors now carry the column
index of the offending value.
Fixed
- Stream finalization data race where
sqlite3_finalizecould run
without the connection Mutex held — a BEAM-segfault-class bug. stream_fetchnow holds the Mutex for the entire fetch loop (was
dropping it between steps).- TOCTOU race in the
with_connclosed-flag check. - Atom-table exhaustion protection: user input no longer becomes atoms
unconditionally. - SQL length overflow guard in
stream_open. - Integer-truncation guard for FFI bind calls.
- Identifier quoting: single quotes → double quotes for SQLite spec
compliance. - PRAGMA name validation against SQL injection (reject non-identifier
PRAGMA names). - PRAGMA validation catch-all for unknown names and corrected numeric
ranges. - Interruption detection, cancel ordering, and error-code mapping.