Skip to main content

Module record

Module record 

Source
Expand description

The SQLite record format: how a row (or index key) is serialized to bytes.

A record is a header followed by a body (file-format spec, “Record Format”):

┌───────────────┬───────────────────────────┐
│ header        │ body                      │
│ varint hdrlen │ serialtype varints…       │ value bodies…
└───────────────┴───────────────────────────┘

The header begins with a varint giving the total header length in bytes (including that varint), then one serial-type varint per column. The body is the concatenation of each column’s bytes, laid out exactly as its serial type dictates (see SerialType). Integers are big-endian and sign-extended.

Functions§

decode_record
encoding selects how TEXT bodies are interpreted (UTF-8 or UTF-16).
encode_record
Decode a complete record into its column values.