Expand description
SQLite databases, read only.
A database is a file of tables. One with a single table of its own opens it; one
with several is a place on the home screen whose rows are its tables, each named by
a path inside the file (app.db/users) that nothing on disk has. --table picks
one by name either way.
A table is read in place. The dataset’s frame is a scan of it (open_table) whose
windows SQLite reads by the table’s key, so the first rows show at once and the last
page costs what the first does; the sidebar’s filters and sort run in SQLite as
WHERE and ORDER BY (see crate::pushdown), where its indexes serve them, and
the row count is SQLite’s count(*). What reads the whole view (analysis, a query,
an export) has it read a batch at a time from SQLite, and nothing is copied to disk.
Nothing is written to the database. It is opened read only, with query_only,
defensive mode and an untrusted schema, and with extension loading left out of the
build. Reading a table runs no trigger. A database in WAL mode with a -wal file is
read through it, and SQLite creates the -shm index beside it if that is missing; one
with no -wal is read as it stands (immutable=1), writing nothing. A database that
cannot be read without writing beside it (a hot journal, or a -wal without its
-shm in a read-only directory) is refused rather than read wrong.
Re-exports§
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 andPOINT(holding “INT”) an integer. - Pick
- What opening a database without
--tablefinds: 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 SQLite tab of the Info panel for the database at
path, whosetablesthe open listed: the database’s page size and versions, and each table of its own with its kind, columns and the rowsANALYZEstored for it. Nothing here reads a table: a count of every table’s rows would be a pass over the whole database. - is_
sqlite_ file - Whether the file at
pathis a SQLite database, by its first bytes. - looks_
like - Whether
head, the first bytes of a file, begins a SQLite database. - open_
table - Open
tableof the databasefile(nameddisplayto the user) in place: the frame over it, what the dataset runs its filters and sort through, and the hold that stops its statements when the dataset lets go.othersare the database’s other tables, for the Info panel. - pick
- The table
wantednames amongtables, or the database’s one table of its own when nothing is named.displaynames the database in errors. - schema_
preview - The columns
tableopens 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.