Files
sx/library/vendors/sqlite
agra 410a52e4ca refactor(ffi-linkage): Phase 6.1 — migrate vendors/sqlite #foreign→extern
Pure source rename: all 97 'sqlite3_* ... #foreign sqlib "csym";' fn decls
→ 'extern sqlib "csym";' (+ the one stale header-comment reference). The
extern_lib axis references the 'sqlib' #import c unit identically to #foreign
sqlib, so IR/output is byte-identical. Empty snapshot diff; example 1624
(vendor-sqlite-module) stdout byte-unchanged. Suite green (647 corpus / 444
unit, 0 failed).
2026-06-15 04:25:34 +03:00
..

vendors/sqlite — SQLite for sx programs

#import "vendors/sqlite/sqlite.sx" gives any sx program SQLite with no system dependency and no build flags. The bindings declare the amalgamation as a named #import c unit carrying the pinned compile options (SQLITE_DQS=0, SQLITE_THREADSAFE=0, SQLITE_DEFAULT_MEMSTATUS=0, SQLITE_OMIT_DEPRECATED, SQLITE_OMIT_SHARED_CACHE, SQLITE_LIKE_DOESNT_MATCH_BLOBS, SQLITE_ENABLE_COLUMN_METADATA, -O2); sx compiles the unit through its content-addressed object cache (.sx-cache/), so the 250k-line source builds once per machine. sx build links the objects into the binary; sx run loads them as a PRIORITY symbol-search target ahead of the process images, so an OS libsqlite3 of a different version can never shadow this copy. examples/1624-vendor-sqlite-module.sx pins the version and a typed round trip in the sx suite.

Bound surface

sqlite.sx maps the full practical C API (~100 functions): connection lifecycle + open_v2 flags, errors (extended codes included), statements with the complete bind/column families, parameter and column introspection (built with SQLITE_ENABLE_COLUMN_METADATA), incremental blob I/O, the online backup API, serialize/deserialize, and the library utilities. Not bound, by design: callback-taking APIs (hooks, UDFs, collations, authorizers — they need C→sx callbacks), the sqlite3_value_* family (UDF-coupled), varargs configuration, UTF-16 variants, and subsystems this build omits (mutex/VFS under SQLITE_THREADSAFE=0, sessions/snapshots/vtabs, deprecated API).

To upgrade: replace c/sqlite3.c/c/sqlite3.h with a newer amalgamation, update this file and the version pins in consuming test suites, and rebuild (the object cache keys on the source bytes, so the new amalgamation recompiles automatically).