classSortScopes
final class SortScopes
Derives ORDER BY and GROUP BY terms in the environment SQLite resolves each of them in.
Rule: SQLITE-SORT-SCOPE-001. An integer constant denotes the result column at that position (SQLITE-OUTPUT-ORDINAL-001). In ORDER BY, a term that is one unqualified word, possibly in parentheses or under COLLATE, and equals a result column alias denotes that result column before any input column of the same name. Every other term is an expression over the input columns, in which a result column alias is used when no input column has the name, and is a single value (SQLITE-ROW-VALUE-USE-001). Terminates: one pass over the terms. Source: https://sqlite.org/lang_select.html#the_order_by_clause. Status: Implemented.
Methods§
public function derive(
list<Scalar> $terms,
Derivation $derivation,
Environment $environment,
list<Field|OpenStar> $projection,
bool $aliasFirst,
): voidDerives the terms.
Parameters
$terms | list<Scalar> | The term expressions in written order |
$derivation | Derivation | |
$environment | Environment | The environment of an ordinary term: input relations and aliases |
$projection | list<Field|OpenStar> | The result columns of the query |
$aliasFirst | bool | Whether a bare alias wins over an input column, as in ORDER BY |
Test cases 2
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:86
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:59
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:68
Calls 6
- method-call SortScopes::word() line 57
- method-call Derivation::scalar() line 59
- new Environment line 59
- method-call Environment::aliased() line 60
- method-call RowValueUse::single() line 63
- new RowValueUse line 63
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Relations§
Instantiated in 3
- new SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:86
- new SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:59
- new SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:68
Method calls 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:86
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:59
- method-call SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:68