Library:SQLite
| Developer | D. Richard Hipp, Dan Kennedy, Joe Mistachkin and the SQLite developers |
|---|---|
| Platforms | any (portable C; Windows, Linux, macOS, Android, iOS, embedded, wasm) |
| Versions | 3.0.0 (2004) to 3.54.1 (2026-10-16); 3.X.Y, SQLITE_VERSION_NUMBER = 3000000 + X*1000 + Y |
| License | public domain (blessing instead of a license) |
| Website | https://sqlite.org |
| On this wiki | Facts · Code · Notes · Topics |
The embedded SQL database engine in C (public domain), compiled into a huge number of programs from its single-file amalgamation sqlite3.c or shipped as sqlite3.dll / libsqlite3.so / winsqlite3.dll. Its source id string (check-in date and Fossil hash), the `mov eax, SQLITE_VERSION_NUMBER; ret` of sqlite3_libversion_number, its compile-option strings and its keyword table identify and date a build, and its corruption checks carry amalgamation line numbers.
Overview
SQLite is distributed as the "amalgamation": one generated C file, sqlite3.c (about 269,000 lines in 3.53.1), plus sqlite3.h, built from the src/ and ext/ trees of the Fossil repository (mirrored at https://github.com/sqlite/sqlite). Because it is a single file without dependencies, most programs compile it straight into their own binary, so it is one of the most common statically linked libraries; others ship it as sqlite3.dll, libsqlite3.so.0, winsqlite3.dll (Windows System32), msys-sqlite3-0.dll or cygsqlite3-0.dll, or inside a bigger DLL (Firefox's nss3.dll). The code is in the public domain. It reads and writes the Format:SQLite database file and its journal and WAL files.
Versions are 3.X.Y with SQLITE_VERSION_NUMBER = 3000000 + X*1000 + Y (3.53.1 = 3053001); patch releases before 3.9.0 had a fourth version component (the first patch of 3.8.7 has the sort key 3080701).
Identification
- Strings in every build checked (3.8.8 to 3.53.4):
SQLite format 3(the file magic, as a 16-byte constant),database disk image is malformed,unable to open database file,no such table: %s,sqlite_master, and the keyword table zKWText that startsREINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT(Fact:SQLite/string/Keyword text, Fact:SQLite/signature/zKWText; 49 of the 50 SQLite-containing DLL/EXE files among 7857 scanned, none without SQLite). SQLITE_OMIT_* options drop keywords and change that text: oneds.dll's startsBEFOREIGNOREFERENCESCAPEACHECKEYISNULLSAVEPOINTERSECT. Since 3.33.0 alsosqlite_schema. - Source id: SQLITE_SOURCE_ID,
"YYYY-MM-DD HH:MM:SS <hash>", the UTC date of the check-in and its Fossil hash (SHA3-256, 64 hex digits; SHA1, 40 digits, in older versions such as 2014's), returned by sqlite3_sourceid() (Fact:SQLite/identification/Source id string). The first 10 hex digits of the hash of every release are listed with its version at https://sqlite.org/chronology.html; a hash that is not there is a pre-release or trunk build, whose version string names the next release. Variants:- hash truncated to 60 digits plus
alt1: built from a source tree in which a file differs from the Fossil manifest (a distribution's patches), e.g. msys-sqlite3-0.dll 3.46.1 of Git for Windows (...f69aalt1). fts5: <date> <hash>: the FTS5 extension's own copy (fts5_source_id()), always the unmodified manifest hash, present when FTS5 is compiled in.- lld-linked builds (Firefox's nss3.dll, linker version 14.0) contain only the
fts5:string: string tail merging made sqlite3_sourceid() point 6 bytes into it.
- hash truncated to 60 digits plus
- Version number: sqlite3_libversion_number() is
mov eax, SQLITE_VERSION_NUMBER; ret, i.e.B8 <imm32> C3(3.53.1:B8 C9 95 2E 00 C3), found exactly once in each of the 10 x86 and x64 builds in the table below (Fact:SQLite/identification/sqlite3_libversion_number immediate). A static build may drop the unused function (Edge WebView's oneds.dll 3.53.2 has no match); the number then still occurs 3-4 times big-endian (00 2E 95 CA), because the code that writes header offset 0x60 of databases stores the byte-swapped constant. The text version (3.53.1) is a separate string but is not always NUL-delimited on both sides. - Compile options: sqlite3_compileoption_get() reads a sorted table of option names without the SQLITE_ prefix (
COMPILER=msvc-1944,DEFAULT_PAGE_SIZE=4096,ENABLE_FTS5,OMIT_UTF16,THREADSAFE=1...), stored as plain strings, which tells how the library was configured and with which compiler (Fact:SQLite/identification/Compile option strings).COMPILER=gives the compiler and its version (msvc-1938,gcc-13.3.0,clang-...). - Error messages (sqlite3ErrStr):
SQL logic errorin current versions,SQL logic error or missing databasein old ones (seen in 3.8.8, gone by 3.34.0). - Exports: sqlite3_open_v2, sqlite3_prepare_v2, sqlite3_step, sqlite3_column_text, sqlite3_finalize, sqlite3_close ... (about 300 in a full build). A static copy keeps the names only if the host exports them; Firefox's nss3.dll does not.
Versions
Builds read for this page (Windows, x86/x64; source id, version function or its big-endian copy, and version text agreed wherever present):
| Build | Version | Source id hash (first 10) | COMPILER= | Notes |
|---|---|---|---|---|
| winsqlite3.dll (Windows 11 System32, October 2026) | 3.53.4 | bf7c7f3003 | msvc-1938 | ENABLE_API_ARMOR, ENABLE_FTS5, ENABLE_RBU, OMIT_LOCALTIME |
| nss3.dll (Firefox, static) | 3.53.4 | bf7c7f3003 (fts5: copy only) |
none | no compile-option strings (unverified: built with SQLITE_OMIT_COMPILEOPTION_DIAGS) |
| sqlite.dll (Adobe Acrobat) | 3.53.3 | d4c0e51e4a | msvc-1938 | OMIT_UTF16, OMIT_EXPLAIN, OMIT_AUTHORIZATION, no FTS5 |
| sqlite3.dll (CPython 3.11) | 3.53.1 | c88b22011a | msvc-1944 | ENABLE_FTS5, ENABLE_MATH_FUNCTIONS, OMIT_AUTOINIT |
| oneds.dll (Edge WebView, System32, static) | 3.53.2 | d6e03d8c77 | none | no sqlite3_libversion_number (version only big-endian), no option strings, OMIT keyword variant |
| sqlite3.dll (LibreOffice) | 3.53.0 | 4525003a53 | msvc-1944 | |
| MipDlp.dll (Windows Defender, static) | 3.49.1 | 873d4e274b | msvc-1929 | |
| msys-sqlite3-0.dll (Git for Windows) | 3.46.1 | c9c2ab54ba (alt1) |
gcc-13.3.0 | SECURE_DELETE, ENABLE_SESSION |
| logsession.dll (Adobe Acrobat, static) | 3.34.0 | a26b6597e3 | msvc-1929 | only two option strings |
| sqlite3.dll x86 and x64 bundled with an open-source tool | 3.8.8 trunk (3008008) | 1a7e711ed1 (SHA1; not a release) | none | 2014-10-28, between 3.8.7 and its first patch release |
Corruption line numbers
SQLITE_CORRUPT_BKPT, SQLITE_MISUSE_BKPT and SQLITE_CANTOPEN_BKPT call sqlite3CorruptError(LINE) and friends, which log "%s at line %d of [%.10s]" with the line number and the first 10 hash digits of the source id. In a release build __LINE__ is the line in that version's amalgamation sqlite3.c, so every corruption check carries an immediate that points to its source line. In CPython's sqlite3.dll 3.53.1 (MSVC x64), the out-of-line sqlite3CorruptError is called from 51 sites as mov ecx, <line>; call, and 86 more inlined copies load "database corruption" next to a mov of the line; every one of those 137 immediates is a line of sqlite-amalgamation-3530100/sqlite3.c that contains a CORRUPT macro (Fact:SQLite/behavior/Corruption checks carry amalgamation line numbers). With the amalgamation of the identified version, this maps stripped B-tree, pager and VDBE code to source without symbols.
Where it appears
Verified on this wiki by source id: Windows (winsqlite3.dll, Windows Defender), Firefox (nss3.dll), CPython, Git for Windows, LibreOffice, Adobe Acrobat. Unverified but widely documented: Android and iOS system libraries, Chromium (in its own binary), Electron apps, PHP (pdo_sqlite), many game engines and launchers for saves, caches and asset databases, Go programs through mattn/go-sqlite3 (cgo) or modernc.org/sqlite (a C-to-Go translation without these byte patterns).
Code & repositories
- Code:SQLite database file/sqlite3info (Python):
scanfinds an embedded SQLite in any binary and prints its source ids (with the release from a bundled list of all 268 SQLite 3 releases), libversion_number candidates, compiler and compile options; the other commands read databases, WALs and journals. - {{Repo|url=https://github.com/sqlite/sqlite%7Ccommit=43a48f77585a88940c727f33682151418f544059%7Clicense=blessing (declared by the contributor; GitHub's detector did not recognize LICENSE.md)|description=Official Git mirror of the SQLite Fossil repository (public domain: src/, ext/, test/, tool/). File format layouts are documented in src/btreeInt.h, src/wal.c and src/pager.c; serial types in src/vdbeaux.c; source-id, keyword and compile-option generators in tool/ (mksourceid.c, mkkeywordhash.c, mkctimec.tcl); JSONB in doc/jsonb.md; registered application ids in magic.txt; fuzz databases under test/. Release tags (version-3.X.Y) to diff a binary against; the amalgamation itself is a build product downloaded from sqlite.org.|tested_on=Read at this commit (3.55.0 development); layouts checked against databases, WALs and journals written by SQLite 3.53.1 and against 11 Windows builds (3.8.8 to 3.53.4) with Code:SQLite database file/sqlite3info (Python). Not built.|checked=checked 2026-10-17; last activity 2026-10-17}}
Pitfalls
- An application may bundle several SQLite copies of different versions (Acrobat: 3.53.3 in sqlite.dll, 3.34.0 static in logsession.dll); scan each module.
- Encrypting forks (SQLCipher, SEE, wxSQLite3) keep the same strings and source ids; look for their own strings (
cipher_,PRAGMA key) before assuming plain SQLite. - The 16-byte
SQLite format 3string in a binary is the library, not a database: databases start with it at file offset 0.
Evidence & references
- https://github.com/sqlite/sqlite at commit 43a48f77585a88940c727f33682151418f544059: src/sqlite.h.in lines 119-148 (version macros), src/main.c lines 85-111 (sqlite3_libversion, sqlite3_sourceid, sqlite3_libversion_number) and 4015-4045 (sqlite3ReportError, sqlite3CorruptError), tool/mksourceid.c lines 829-833 (source id and
alt1), ext/fts5/tool/mkfts5c.tcl lines 78-93 (fts5 source id), tool/mkkeywordhash.c lines 545-580 (zKWText), src/main.c line 1684 (SQL logic error). - sqlite-amalgamation-3530100.zip from sqlite.org (for the line-number check) and https://sqlite.org/chronology.html (release hashes, read 2026-10-17).
- The DLLs and EXEs in the table were read as files with small Python scripts (strings,
B8 imm32 C3, rip-relative references in .text); nothing was loaded or run.