Skip to main content

Module bind

Module bind 

Source
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§

AllowAll
An authorizer that allows everything, which is the default.
Binder
The binder’s working state for one statement.
BinderScratch
The vectors a binder works in, kept by the connection rather than made for every statement.
BoundAggregate
One aggregate the statement computes.
BoundOrderTerm
One ORDER BY term, bound.
BoundResultColumn
One result column, after star expansion.
BoundSelect
A bound SELECT.
BoundSource
One FROM term, bound to a table.
BoundWindow
One window function call, with the window it is computed over.
ColumnUse
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.
RecursiveBody
A recursive CTE’s arms, split by whether they refer to the CTE.

Enums§

AuthAction
One action an authorizer is asked about.
Authorization
What an authorizer decided about one action.
BoundExpr
A bound expression, with every name resolved and every rule decided.
BoundFrameBound
One end of a window frame, bound.
BoundStatement
A bound statement.
IndexChoice
Which indexes the planner may use for one FROM term.
SourceRows
Where one FROM term’s rows come from.
SubqueryKind
What a nested query used as a value does with its rows.
WindowCall
What a window call computes.

Constants§

EXCLUDED_SOURCE
The source number a column of an upsert’s excluded row 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 NEW row carries.
OLD_SOURCE
The source number a column of a trigger’s OLD row 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§

ColumnOrigin
Where a result column came from: database, table, and column name.