Expand description
quantydb-sqlite: a reader for the SQLite 3 file format.
This crate exists so that importing a .sqlite file needs no SQLite
library, no C toolchain and no ffi (ADR-005). It only ever reads, and
the type it reads through cannot write, so the file being imported
cannot be damaged by us.
The bar it is held to is the same one our own format reader meets: any input at all, including one built specifically to break it, produces either correct data or an error. Never a panic, never a row that is not in the file.
use quantydb_sqlite::{FileSource, Reader};
let reader = Reader::open(FileSource::open("chinook.sqlite")?)?;
println!("{} pages of {} bytes", reader.page_count(), reader.header().page_size);Structs§
- Btree
Page - One b-tree page, with its header parsed and its cell pointers validated.
- Column
Def - A column as the create statement declared it.
- Column
Survey - What one column turned out to hold.
- File
Source - A file opened read only.
- Header
- Index
Scan - A walk of an index b-tree, yielding its entries in key order.
- KeyColumn
- One column of a primary key, in key order.
- Reader
- A SQLite database file, opened for reading.
- Row
- One row from a scan, whichever kind of table it came from.
- RowLayout
- Lines a table’s records up with its declared columns.
- Schema
- Everything the database says about itself.
- Schema
Object - One row of the schema table.
- Slice
Source - Bytes already in memory. Used by the tests and by the fuzz harness.
- Table
Def - Table
Row - One row of a table: its rowid and the values of its columns.
- Table
Scan - A depth first walk of a table b-tree, yielding rows in rowid order.
- Table
Survey - What a whole table turned out to hold.
- Wal
- A
-walfile, read up to its last commit. - WalSource
- A database file with its log read on top of it.
Enums§
- Affinity
- Cell
- A cell with its payload assembled, overflow pages included.
- Constraint
- A rule the source enforces that we have no equivalent for.
- Generated
- Whether a column is computed, and if so whether the file holds it.
- Mapped
Cell - A column’s value in one row, once the record has been lined up with the declaration.
- Object
Kind - Page
Kind - What a b-tree page holds. Table pages are keyed by rowid, index pages by the indexed values.
- Rows
- A scan of either kind of table, yielding rows the same way.
- Sqlite
Error - Sqlite
Value - One of SQLite’s five storage classes.
- Storage
Class - SQLite’s five storage classes: what a value physically is.
- Text
Encoding - Text encoding of every text value in the database.
Traits§
Functions§
- decode_
record - Decode one record into its values.
- open_
file - Open a database file by path, log included if there is one.
- parse_
create_ table - Parse a
create tablestatement into the shape of the table it makes.