Skip to main content

Module sqlite

Module sqlite 

Source
Expand description

SQLite databases, read only.

A database is a file of tables: one with a single table opens it; several make a home place listing tables by path inside the file (app.db/users); --table picks by name. Tables are read in place (open_table): windows by the table’s key (so the last page costs what the first does), sidebar filters and sort run as WHERE/ORDER BY (see crate::formats::pushdown), counts via count(*), whole-view reads in batches; nothing is copied to disk.

Nothing is written: read only, query_only, defensive mode, untrusted schema, no extension loading, no triggers. A WAL database with -wal is read through it (SQLite may create -shm); one without is read immutable=1. A database needing a write to read (a hot journal, or -wal without -shm in a read-only directory) is refused rather than misread.

Structs§

Hold
Held by a dataset read in place: dropped, whatever SQLite is running for it stops.
Opened
A table opened in place, as the dataset takes it.
Table
One table of a database, as its schema describes it.

Enums§

Affinity
How SQLite reads a declared type: the affinity rules of its documentation, in order, so VARCHAR(10) is text and POINT (holding “INT”) an integer.
Pick
What opening a database without --table finds: its one table of its own, or the names of several, which the home screen lists.

Constants§

MAGIC
The first sixteen bytes of every SQLite 3 database.
SCAN_NAME
The name a SQLite scan carries in a plan.

Functions§

detail
The Info panel’s SQLite tab for path’s listed tables: page size, versions, and each table’s kind, columns and ANALYZE row estimate. Reads no table (counting all would scan the database).
looks_like
Whether head, the first bytes of a file, begins a SQLite database.
open_table
Open table of database file (shown as display) in place: its frame, the pushdown for filters and sort, and the hold that stops its statements when released. others are the other tables, for Info.
pick
The table wanted names among tables, or the database’s one table of its own when nothing is named. display names the database in errors.
schema_preview
The columns table opens with, read from its first rows the way the open decides them, for the home screen’s preview. Gives up after a moment.
tables
The tables and views of the database at path, SQLite’s own included, in the order they were created; the schema table last.