classSortRule
final class SortRule
Lowers ordering terms and column name lists.
Rule: SQLITE-SORT-LOWER-001. Scope: sortlist, sortorder, nulls, eidlist, eidlist_opt, orderby_opt. Terms keep their written order, direction and NULL placement. In the ORDER BY clause of a query an integer constant is a request for the result column at that position; everywhere else it is an ordinary constant. Terminates: lists are flattened iteratively. Source: https://sqlite.org/lang_select.html#the_order_by_clause, https://sqlite.org/syntax/indexed-column.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a sortlist into its terms in written order.
Parameters
$sortlist | Node | |
$ordinals | bool | Whether an integer constant names a result column, as in the ORDER BY clause of a query |
Returns
list<SortTerm>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 10
- static-call ImplementationGap::production() line 51
- method-call Lists::items() line 53
- new Lists line 53
- function-call
countline 55 - method-call Ordinals::value() line 57
- new Ordinals line 57
- new OutputOrdinal line 58
- new SortTerm line 60
- method-call SortRule::direction() line 60
- method-call SortRule::nulls() line 60
Lowers an orderby_opt of a query: its terms, or none when the clause is absent.
Parameters
$clause | Node | |
$ordinals | bool |
Returns
list<SortTerm>Throws
ImplementationGap When the production has no ruleCalls 2
- method-call SortRule::terms() line 78
- static-call ImplementationGap::production() line 79
public function direction(Node $sortorder): ?SortDirectionLowers a sortorder: the written direction, or null when none is written.
Parameters
$sortorder | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
Calls 3
- class-const SortDirection::Ascending() line 94
- class-const SortDirection::Descending() line 95
- static-call ImplementationGap::production() line 96
public function nulls(Node $nulls): ?NullsOrderLowers a nulls: the written NULL placement, or null when none is written.
Parameters
$nulls | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 3
- class-const NullsOrder::First() line 111
- class-const NullsOrder::Last() line 112
- static-call ImplementationGap::production() line 113
public function columns(Node $eidlist): list<ListedColumn>Lowers an eidlist into its column names in written order.
Parameters
$eidlist | Node |
Returns
list<ListedColumn>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 6
- static-call ImplementationGap::production() line 127
- method-call Lists::items() line 129
- new Lists line 129
- function-call
countline 131 - new ListedColumn line 132
- method-call SortRule::direction() line 132
public function optionalColumns(Node $list): list<ListedColumn>|nullLowers an eidlist_opt: the column names, or null when the list is absent.
Parameters
$list | Node |
Returns
list<ListedColumn>|nullThrows
ImplementationGap When the production has no ruleCalls 2
- method-call SortRule::columns() line 150
- static-call ImplementationGap::production() line 151
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
SortRuleTestcalls