pub struct Query {
pub ctes: Slice,
pub body: QueryBody,
pub order_by: Slice,
pub order_by_all: bool,
pub limit: ExprRef,
pub limit_percent: bool,
pub offset: ExprRef,
}Expand description
A query: a body, plus the modifiers that apply to whatever the body produced.
The split is the grammar’s, not an invention. SelectStatementInternal <- WithClause? SelectSetOpChain ResultModifiers? puts ORDER BY and LIMIT outside the set operator chain,
which is the only place they can go and be right: a UNION b ORDER BY x sorts the union and not
the second half of it. Hanging them off Select instead would have made that unrepresentable.
Fields§
§ctes: SliceThe materialised WITH definitions this query introduces, as a run of indexes into
Ast::ctes held in Ast::cte_lists, outermost first.
A list of indexes rather than a run of the arena itself, because a materialised WITH
inside another one is pushed while the outer one is still being built, so what one query
owns is not a contiguous stretch of the arena.
body: QueryBodyWhat produces the rows.
order_by: SliceThe ORDER BY list, as a run of OrderItem.
order_by_all: boolWhether the clause was ORDER BY ALL.
limit: ExprRefThe LIMIT expression, or NONE.
limit_percent: boolWhether the limit was a percentage rather than a row count.
offset: ExprRefThe OFFSET expression, or NONE.