Expand description
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.
Two entries share the code: analyze, replayed through the Host like every dialect, and
analyze_ddl, for a host that holds a live connection and runs DDL_QUERY and
FUNCTIONS_QUERY on it itself, with Extras naming the scalar functions it registers there.
Structs§
- Extras
- What a host says of the SQLite on its own connection: the functions it registers there, and
the functions that SQLite has (
FUNCTIONS_QUERY;Nonewhen it cannot list them). - Host
Function - One row of
FUNCTIONS_QUERY. - Sqlite
Analysis analyze_ddl’s answer: the analysis, and what the tree adds for a host that types a result column by the spelling its table declares.- Total
Function - A scalar function the host registers on its own connection, which the engine’s replay cannot
see: the replay registers a stub under the same name and argument count, so a statement calling
it prepares, and the function table types a call as
returns, NULL only when an argument is. A function the host vouches for as total, Postgres’sTrust::totalin SQLite’s terms: NULL only when an argument is, with the argument count SQLite resolves a call by.
Enums§
- Affinity
- A storage class a value lands in, as SQLite names a column’s affinity.
Constants§
- DDL_
QUERY - The schema, as SQLite stores it: its
sqlcolumn is the DDL the engine replays into its in-memory copy. The replayed entry asks the host for it; a host with a connection of its own runs it there and hands the rows toanalyze_ddl. - FUNCTIONS_
QUERY - The functions the host’s SQLite has, which decide what a statement may call: SQLite builds
differ in them (the math functions,
soundex, a newer release’s additions), and the embedded one has every optional family, so it alone would accept a call the host then refuses to run. The replayed entry asks the host for it; a host with a connection of its own runs it there and hands the rows toExtras::hostthroughhost_functions. A SQLite that cannot answer (an old one whose pragma lacks these columns, or a service that refuses the pragma) is taken to have what the embedded one has.
Functions§
- affinity
- SQLite’s five affinity rules over a declared type.
- analyze
- The replayed entry: the host answers
DDL_QUERYandFUNCTIONS_QUERY(session-scoped, asked in one round), the rest is [run].markednames the parameters cast tonullable(…). - analyze_
ddl - The direct entry, for a host with a connection of its own:
ddlis thesqlcolumn ofDDL_QUERYrun there,extrasthe functions it registers there. No round trip; a lex error, a prepare error (SQLite’s own message, at its offset) and a replay failure come back as diagnostics, as on the replayed path. - host_
functions - The rows of
FUNCTIONS_QUERYas the host’s function list;Nonewhen there is none to read, since every SQLite has functions and an empty list would refuse every call.