Expand description
The binder: names to columns, and the bound relational tree.
Invariant: the binder is a pure function of one SQL text and one immutable catalog snapshot. It resolves every name, expands every star, decides every affinity and collation, and extracts every aggregate, and it does all of that before a single page is read. A bound statement therefore says exactly what it will touch, which is what lets the authorizer run here rather than part-way through execution.
Resolution order is SQLite’s: FROM terms left to right, then result aliases
where SQLite permits them, with a column always preferred over an alias of
the same name. rowid, _rowid_ and oid resolve only on a rowid table
and only when no real column shadows them.
Structs§
- Allow
All - An authorizer that allows everything, which is the default.
- Binder
- The binder’s working state for one statement.
- Binder
Scratch - The vectors a binder works in, kept by the connection rather than made for every statement.
- Bound
Aggregate - One aggregate the statement computes.
- Bound
Order Term - One
ORDER BYterm, bound. - Bound
Result Column - One result column, after star expansion.
- Bound
Select - A bound SELECT.
- Bound
Source - One FROM term, bound to a table.
- Bound
Window - One window function call, with the window it is computed over.
- Column
Use - Which of one FROM term’s columns a query reads.
- CteBinding
- One common table expression visible to a block.
- Dependencies
- Every database and cookie a bound statement depends on.
- Recursive
Body - A recursive CTE’s arms, split by whether they refer to the CTE.
Enums§
- Auth
Action - One action an authorizer is asked about.
- Authorization
- What an authorizer decided about one action.
- Bound
Expr - A bound expression, with every name resolved and every rule decided.
- Bound
Frame Bound - One end of a window frame, bound.
- Bound
Statement - A bound statement.
- Index
Choice - Which indexes the planner may use for one FROM term.
- Source
Rows - Where one FROM term’s rows come from.
- Subquery
Kind - What a nested query used as a value does with its rows.
- Window
Call - What a window call computes.
Constants§
- EXCLUDED_
SOURCE - The source number a column of an upsert’s
excludedrow carries. - MAX_
COMPOUND_ SELECT - How many arms a compound SELECT may have, which is
SQLITE_MAX_COMPOUND_SELECT. - MAX_
GENERATED_ DEPTH - How deep one generated column may reach through others.
- MAX_
SELECT_ DEPTH - How deeply query blocks may nest.
- NEW_
SOURCE - The source number a column of a trigger’s
NEWrow carries. - OLD_
SOURCE - The source number a column of a trigger’s
OLDrow carries.
Traits§
- Authorizer
- The callback the binder consults before it binds an action.
Functions§
- block_
over - Returns a block that reads one FROM term and nothing else.
- comparison_
rules - Returns the affinity and collation a comparison between two operands uses.
- result_
collation - Returns the collation a result column compares with.
- subquery_
columns - Builds the table a nested query’s rows are read through.
Type Aliases§
- Column
Origin - Where a result column came from: database, table, and column name.