Files
distribution/vendor/sqlite/README.md
agra 06f99b3606 sqlite is part of the program: #import c unit replaces the Makefile cc build
src/db/sqlite.sx declares the vendored amalgamation as a named
'#import c' unit (pinned defines + -O2 + #source); every #foreign
binding resolves against it with UNPREFIXED sqlite3_* names. sx
compiles the unit through its content-addressed object cache — once
per checkout — links the objects into 'sx build' binaries, and loads
them as a priority symbol target under 'sx run', so the OS libsqlite3
can never shadow the vendored copy (the version pin in sqlite_smoke
proves it).

Retired: the Makefile vendor targets (cc -> .a + jit/.dylib), the
GENERATED dist_sqlite3_* rename.h (the JIT no longer resolves
program-owned symbols through the process images, so the rename's
reason is gone), and the -L plumbing in make build + tests/run.sh.
make test 22/22; otool -L build/dist carries no libsqlite3.
2026-06-12 17:27:21 +03:00

43 lines
2.3 KiB
Markdown

# Vendored SQLite
- Version: **3.53.2** (`SQLITE_VERSION` in `sqlite3.h`)
- Source: <https://sqlite.org/2026/sqlite-amalgamation-3530200.zip>
- Zip sha256: `8a310d0a16c7a90cacd4c884e70faa51c902afed2a89f63aaa0126ab83558a32`
- Files kept: `sqlite3.c`, `sqlite3.h` (the amalgamation; `shell.c` and
`sqlite3ext.h` dropped — no shell, no loadable extensions)
- License: public domain (<https://sqlite.org/copyright.html>)
The amalgamation is part of the program, not the build system:
`src/db/sqlite.sx` declares it 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`), and every `#foreign sqlib`
binding resolves against that unit. sx compiles the unit through its
content-addressed object cache (`.sx-cache/`), so the 250k-line source
builds once per checkout — `sx build` links the objects into the
binary, `sx run` loads them as a PRIORITY symbol-search target ahead of
the process images, which is why the OS libsqlite3 (a different
version, loaded into the compiler process by CoreServices) can never
shadow this copy. `tests/sqlite_smoke.sx` asserts
`sqlite3_libversion()` equals the version above, so any fallback fails
loudly in both modes.
## Bound surface
`src/db/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 `sqlite3.c`/`sqlite3.h` with a newer amalgamation,
update this file and the version constant in `tests/sqlite_smoke.sx`,
and run `make clean test` (the object cache keys on the source bytes,
so the new amalgamation recompiles automatically).