Expand description
Database file header (page 0).
The first 28 bytes of every .sqlrite file identify the format and point
at the schema catalog. The rest of page 0 is reserved for future use.
Structs§
- DbHeader
- Parsed header.
page_countincludes page 0 itself.
Constants§
- FORMAT_
VERSION_ BASELINE - The version a brand-new write defaults to when no FTS index forces a bump. Existing databases keep their on-disk version unchanged across reads + non-FTS writes; FTS-bearing saves switch to V5, freelist-bearing saves switch to V6.
- FORMAT_
VERSION_ V4 - On-disk format revision. Bump when the page layout changes incompatibly.
- FORMAT_
VERSION_ V5 - FORMAT_
VERSION_ V6 - MAGIC
- File magic. Distinct from SQLite’s
"SQLite format 3\0"so the formats can’t be confused on inspection.
Functions§
- decode_
header - Decodes the header from a
PAGE_SIZE-sized buffer. Returns an error if magic bytes, format version, or page size don’t match what we wrote. V4, V5, and V6 are accepted; the result’sformat_versionechoes what was on disk so a no-op resave preserves it.freelist_headis read from bytes [28..32] for V6 files; V4/V5 files have a zero reserved region there, so the field decodes as0either way. - encode_
header - Encodes the header into a
PAGE_SIZE-sized buffer.