Skip to main content

Crate reylo_engine_sqlite

Crate reylo_engine_sqlite 

Source
Expand description

Reylo’s analysis engine for SQLite, over the core every database shares (reylo_engine_core): SQLite’s own resolved tree, from an amalgamation patched with the engine’s hooks (sqlite_tree), and the function tables and row-count proof over it (sqlite). No other parser is linked: what SQLite resolves is what the analysis reads.

Two hosts link it: reylo-engine (engine/native), whose program the reylo binary serves; and a host that runs sqlite::analyze_ddl over a connection of its own.

Re-exports§

pub use api::Sqlite;

Modules§

api
The SQLite side of the request protocol (reylo_engine_core::api).
capabilities
What running a SQLite statement may do (Capabilities), an upper bound: the tables it reads and writes as SQLite resolved them, through views too, and, from the database’s schema, the tables a foreign key’s action writes, the sqlite_sequence an AUTOINCREMENT table’s insert writes, and a trigger’s body, which the engine does not read and so may touch any table.
errors
The errors a SQLite statement may raise, where it runs no trigger (reylo_engine_core::errors): a function the application registers fails the type check, so a trigger is the only code of a user’s a statement may set off. Its constraint errors then name only the tables and columns of the unique keys, the NOT NULL columns, the columns of a STRICT table and the indexes of expressions of the tables it writes. A CHECK’s name is not in the catalog, so a CHECK’s error is not narrowed.
host
The engine’s view of a SQLite database (reylo_engine_core::host), which is never asked to describe: SQLite prepares inside the engine.
sqlite
The SQLite analysis, over SQLite’s own resolved tree (crate::sqlite_tree, produced by csrc/reylo_sqlite.c from a patched amalgamation). SQLite resolves the names, the join sides, every parameter’s context and the DML target columns itself, and reports each expression’s affinity. What SQLite has no facts for stays here, as explicit tables: the result type and nullability of the built-in functions, the type a function gives its arguments, the arithmetic rule, and the row-count proof from the unique keys. The host runs two queries, one for the schema DDL and one for the functions its SQLite has; everything else happens inside the engine.
sqlite_tree
SQLite’s resolved parse tree, as csrc/reylo_sqlite.c serializes it: what SQLite itself resolved while preparing the statement against an in-memory replay of the schema DDL.

Constants§

FINGERPRINT
A fingerprint of the sources this engine was built from: core’s and this crate’s ([reylo_engine_core::fingerprint]).