final class SelectRule
Restricted visibility: declared "@visibility SqlSemantics\Platform\Sqlite". Code outside that scope must not name this declaration.

Lowers query productions into selections, VALUES clauses, compound queries and queries with common tables.

Rule: SQLITE-SELECT-LOWER-001. Scope: select, selectnowith, multiselect_op, oneselect, groupby_opt, having_opt, limit_opt. The arms of a compound query keep their written order; the ORDER BY and LIMIT written after its last arm become those of the compound query. In ORDER BY and GROUP BY an integer constant becomes a result column position (SQLITE-ORDINAL-001). Terminates: the arm list is flattened iteratively; every other child is a strict subtree. Source: https://sqlite.org/lang_select.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function select(Node $select): Select|ValuesClause|Compound|WithQuery

Lowers a complete query.

Parameters

$selectNode

Throws

ImplementationGap When a production has no rule
Calls 3
public function operator(Node $operator): CompoundOperator
public function selection(Form $form, int $shift, bool $ordered): Select

Lowers a selection from its clauses.

Parameters

$formForm
$shiftintThe number of positions the WINDOW clause moves the ORDER BY and LIMIT clauses by
$orderedbool

Returns

Called from 2
Calls 5
public function groups(Node $clause): list<Scalar>

Lowers a groupby_opt: the terms, with integer constants as result column positions.

Parameters

$clauseNode

Returns

list<Scalar>

Throws

ImplementationGap When the production has no rule
Called from 1
Calls 4
public function having(Node $clause): ?Scalar

Lowers a having_opt: the predicate, or null when the clause is absent.

Parameters

$clauseNode

Returns

Throws

ImplementationGap When the production has no rule
Called from 1
Calls 1
public function limit(Node $clause): ?Limit

Private surface 3§

Implementation details, listed for orientation only.

private const PLAIN = 'oneselect: SELECT distinct selcollist from where_opt groupby_opt having_opt or…
private const WINDOWED = 'oneselect: SELECT distinct selcollist from where_opt groupby_opt having_opt wi…
private Lowering $lowering

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type declarations 1