Skip to main content

Crate quantydb_sqlite

Crate quantydb_sqlite 

Source
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§

BtreePage
One b-tree page, with its header parsed and its cell pointers validated.
ColumnDef
A column as the create statement declared it.
ColumnSurvey
What one column turned out to hold.
FileSource
A file opened read only.
Header
IndexScan
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.
SchemaObject
One row of the schema table.
SliceSource
Bytes already in memory. Used by the tests and by the fuzz harness.
TableDef
TableRow
One row of a table: its rowid and the values of its columns.
TableScan
A depth first walk of a table b-tree, yielding rows in rowid order.
TableSurvey
What a whole table turned out to hold.
Wal
A -wal file, 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.
MappedCell
A column’s value in one row, once the record has been lined up with the declaration.
ObjectKind
PageKind
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.
SqliteError
SqliteValue
One of SQLite’s five storage classes.
StorageClass
SQLite’s five storage classes: what a value physically is.
TextEncoding
Text encoding of every text value in the database.

Traits§

Source

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 table statement into the shape of the table it makes.

Type Aliases§

Result