Skip to main content

Module header

Module header 

Source
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_count includes 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.
FORMAT_VERSION_V4
On-disk format revision. Bump when the page layout changes incompatibly.
FORMAT_VERSION_V5
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. Both V4 and V5 are accepted; the result’s format_version echoes what was on disk so a no-op resave preserves it.
encode_header
Encodes the header into a PAGE_SIZE-sized buffer.