classResultRule
final class ResultRule
Lowers result column lists, aliases and VALUES clauses.
Rule: SQLITE-RESULT-LOWER-001. Scope: selcollist, sclp, scanpt, as, distinct (of a selection), values, mvalues. Result columns and rows keep their written order. scanpt is an empty marker of the grammar that carries nothing. A result column without an alias keeps the layout of its expression when it is not the canonical spelling (CORE-SPELLING-001), since SQLite names the column after it; the layout includes a comment written after the expression, which SQLite's name includes. Whether AS introduces an alias is kept, because the text of an enclosing expression includes it. Terminates: both lists are walked along their spine in a loop. Source: https://sqlite.org/lang_select.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function columns(Node $list): list<ResultColumn|Star|TableStar>Lowers a selcollist into its result columns in written order.
Parameters
$list | Node |
Returns
list<ResultColumn|Star|TableStar>Throws
ImplementationGap When a production has no ruleCalls 6
- static-call ImplementationGap::production() line 61
- function-call
array_reverseline 65 - method-call ResultRule::marker() line 66
- method-call ResultRule::column() line 68
- new Star line 69
- new TableStar line 70
public function column(Node $expression, Node $as): ResultColumnLowers one projected expression; without an alias it keeps the spelling SQLite names it after.
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 9
- method-call ResultRule::alias() line 86
- method-call Layouts::of() line 87
- new Layouts line 87
- method-call Canonical::trail() line 87
- new Canonical line 87
- new ResultColumn line 89
- method-call Canonical::same() line 89
- method-call Canonical::layout() line 89
- method-call ResultRule::keyword() line 89
public function marker(Node $marker): voidConfirms that a scanpt is the empty marker of the grammar, which carries nothing.
Parameters
$marker | Node |
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 1
- static-call ImplementationGap::production() line 101
Lowers an as: the alias, or null when none is written.
Parameters
$alias | Node |
Returns
?NameThrows
ImplementationGap When the production has no ruleCalled from 1
Calls 1
- static-call ImplementationGap::production() line 118
public function keyword(Node $alias): boolTells whether an as introduces its alias with the keyword AS, or has no alias.
Parameters
$alias | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleCalled from 1
Calls 1
- static-call ImplementationGap::production() line 134
public function quantifier(Node $distinct): ?SetQuantifierLowers the distinct of a selection: the written quantifier, or null when none is written.
Parameters
$distinct | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalls 3
- class-const SetQuantifier::Distinct() line 149
- class-const SetQuantifier::All() line 150
- static-call ImplementationGap::production() line 151
public function values(Node $values): ValuesClauseLowers a values or mvalues into a VALUES clause with its rows in written order.
Parameters
$values | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalls 4
- static-call ImplementationGap::production() line 169
- function-call
array_reverseline 174 - new ValueRow line 175
- new ValuesClause line 178
Private surface 1§
Implementation details, listed for orientation only.
private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ResultRuleTestcalls