Expand description
Best-effort, dependency-free attribution primitives that reconnect a carved deleted row to the live table it most plausibly belonged to.
A deleted row in free space has lost its hard table linkage (the b-tree that owned it no longer points at it). This module supplies the two structural facts the forensic layer needs to reattach it honestly:
column_names— a hand-rolledCREATE TABLEcolumn-name extractor (no SQL-parser dependency). It returns the declared column names when it can parse them with confidence, orNoneso the caller falls back to genericc0..cNrather than emit wrong names.column_affinity— each column’s declared affinity (file-format §3.1), the shape used to match a freed row whose page linkage is gone.
Pure string/structure work: panic-free, forbid(unsafe), no new deps.
Structs§
- Live
Table - A live (schema-present) table, as read from
sqlite_master: its name, b-tree rootpage, and per-column shape used to attribute a freed row whose page linkage is gone.
Enums§
- Affinity
- Column type affinity as defined by the
SQLitefile format (§3.1, “Type Affinity”). Derived from a column’s declared type by the documented substring rules, in priority order. A column with no declared type isBlob(SQLite’s “BLOB or no datatype” affinity).
Functions§
- column_
affinity - Compute a column’s
Affinityfrom its declared type string per the file-format §3.1 rules, applied in the documented priority order: INT → TEXT → BLOB/none → REAL → NUMERIC. Case-insensitive; an empty (no) declared type isAffinity::Blob. - column_
defs - Best-effort extraction of
(column_name, declared_type)for each column declared in aCREATE TABLEstatement, without a SQL-parser dependency. - column_
names - Just the column names from
column_defs(the common need).Nonewhen the body cannot be parsed with confidence.