CodeVetter · Repo Unpack · Feature catalog
sqlite/sqlite
User-facing surface splits three ways: the C API in `sqlite.h.in`, the `sqlite3` CLI's dot-command language, and the loadable/compiled-in extension set. The CLI carries roughly 40 dot-commands covering schema inspection, import/export, archives, diagnostics, and integrity checking, plus 23 result-output modes now rendered by the new `ext/qrf` formatting library. Extensions add full-text search, spatial indexing, changeset/session replication, incremental update (RBU), corruption recovery, index recommendation, and a large `ext/misc/` grab-bag of 60 single-file functions and virtual tables. Configure-time feature flags (`--all` implies fts4, fts5, rtree, geopoly, session, dbpage, dbstat, carray) decide what lands in the amalgamation.
- `do_meta_command()` (`src/shell.c.in:9947`) dispatches ~40 dot-commands including `.archive`, `.auth`, `.clone`, `.dump`, `.eqp`, `.expert`, `.explain`, `.filectrl`, `.fullschema`, `.import`, `.imposter`, `.intck`, `.iotrace`, `.load`, `.log`, `.mode`, `.open`, `.recover`, `.schema`, `.session`, `.stats`, `.vfsinfo`, `.vfslist`, `.vfsname` and `.wheretrace`.
- The shell supports 23 output modes enumerated in the `aModeInfo[]` table at `src/shell.c.in:618` — ascii, box, c, column, count, csv, html, insert, jatom, jobject, json, line, list, markdown, off, psql, qbox, quote, split, table, tabs, tcl, www — each mapping to a QRF style plus separator/quoting/alignment settings.
- Result formatting was factored out into a new library `ext/qrf/` (headed `2025-10-20`) whose `sqlite3_qrf_spec` struct carries style, escaping, quoting, word-wrap, column widths, alignment, screen width and `xRender`/`xWrite` callbacks; `shell_exec()` copies `pArg->mode.spec` into a local spec and installs `shellWriteQR` as the writer.
- `open_db()` auto-registers a fixed extension set on every connection: sha/shathree, uint, stmtrand, decimal, base64, base85, regexp, ieee754, series, diskused, strdup, and (outside the WASM fiddle build) fileio and completion; zipfile and sqlar are added when `SQLITE_HAVE_ZLIB` is defined and safe mode is off.
- The shell can open databases in four modes chosen by `deduceDatabaseType()` — normal file, append-VFS (`apndvfs`), ZIP archive (opened as `:memory:`), and hex-dump/deserialize — with `~/` expanded against `$HOME` when the literal path does not exist.
- FTS5 is a full subsystem of 15 C files (`fts5_index.c`, `fts5_expr.c`, `fts5_storage.c`, `fts5_tokenize.c`, `fts5_vocab.c`, …) exposing a public `fts5_api` struct with `xCreateTokenizer`, `xCreateTokenizer_v2` and `xCreateFunction` for third-party tokenizers and auxiliary ranking functions.
- The session extension implements changeset capture and replay: `sqlite3session_create`, `sqlite3session_attach`, `sqlite3session_changeset` (plus `_strm` streaming variants) and three generations of apply APIs — `sqlite3changeset_apply`, `_apply_v2`, `_apply_v3` — each with streaming counterparts.
- Database recovery is a first-class feature: `ext/recover/sqlite3recover.c` plus `dbdata.c` implement the `.recover` dot-command by walking raw pages of a corrupt file, and are compiled into the CLI via `INCLUDE` directives.
- The `.expert` command exposes `ext/expert/sqlite3expert.c`, which analyzes a query workload and recommends indexes; `shell_exec()` short-circuits to `expertHandleSQL()` whenever `pArg->expert.pExpert` is active.
- `.intck` runs the incremental integrity-check library `ext/intck/sqlite3intck.c`, an alternative to `PRAGMA integrity_check` that can be run in bounded steps; it ships with its own six-file test suite.
- `ext/misc/` holds 60 single-file extensions (series, regexp, fileio, decimal, base64/base85, uint, sha1/shathree, appendvfs, vfstrace, zipfile, sqlar, completion, memtrace, pcachetrace, diskused, …), most of which are excluded from the core amalgamation but compiled into the CLI.
- In-memory serialization is a supported API path: `sqlite3_serialize()` (`src/memdb.c:750`) and `sqlite3_deserialize()` (`src/memdb.c:841`) move whole database images in and out of process memory, which is also what the shell's hex-db/deserialize open mode relies on.
- Online backup is exposed through `sqlite3_backup_init`/`_step`/`_finish` in `src/backup.c`, and the pager cooperates by calling `sqlite3BackupRestart()` when a commit would invalidate an in-progress backup.
- Feature selection is exposed as configure flags declared in `autosetup/sqlite-config.tcl`: `--threadsafe`, `--load-extension`, `--math`, `--json`, `--memsys3/5`, `--fts3/4/5`, `--rtree`, `--geopoly`, `--session`, `--dbpage`, `--dbstat`, `--carray`, `--update-limit`, `--column-metadata`, with `--all` expanding to `{fts4 fts5 rtree geopoly session dbpage dbstat carray}`.
- `sqlite3_rsync` is a network-facing feature: it syncs a live database between a local path and a `USER@HOST:PATH` remote, with `--ssh`, `--port`, `--exe`, `--protocol` and `--wal-only` options.