classSelectFacts
final class SelectFacts
Derives the facts of a selection.
Rule: SQLITE-SELECT-SCOPE-001. The input relations are derived in the enclosing environment (SQLITE-FROM-SCOPE-001). The result columns see the input relations and, beyond them, the enclosing queries; they do not see each other's aliases. WHERE, GROUP BY, HAVING and ORDER BY see the input columns first and use a result column alias when no input column has the name; ORDER BY and GROUP BY terms follow SQLITE-SORT-SCOPE-001. In an aggregate selection without GROUP BY every input column read by the result columns, HAVING and ORDER BY can be NULL (SQLITE-AGGREGATE-QUERY-001). The named windows see the input columns. LIMIT and OFFSET see no column of the selection. WHERE and HAVING are single values (SQLITE-ROW-VALUE-USE-001). The output fields follow SQLITE-RESULT-NAME-001. Terminates: every clause is a strict part of the selection. Source: https://sqlite.org/lang_select.html. Status: Implemented.
Methods§
public function derive(Select $select, Derivation $derivation, Environment $outer): QueryFactDerives every part of the selection and answers its output.
Parameters
$select | Select | |
$derivation | Derivation | |
$outer | Environment |
Returns
Test cases 2
Called from 1
Calls 18
- method-call FromScope::open() line 47
- new FromScope line 47
- function-call
array_mapline 48 - method-call Aggregation::aggregates() line 49
- new Aggregation line 49
- method-call Joining::extend() line 50
- new Joining line 50
- method-call Projection::items() line 51
- new Projection line 51
- new Environment line 51
- method-call SelectFacts::aliases() line 52
- new RowValueUse line 55
- method-call RowValueUse::single() line 57
- method-call Derivation::scalar() line 57
- method-call SortScopes::derive() line 59
- new SortScopes line 59
- method-call SelectFacts::limit() line 69
- new QueryFact line 71
public function limit(?Limit $limit, Derivation $derivation, Environment $outer): voidDerives the expressions of a LIMIT clause, which see no column of their query.
Parameters
$limit | ?Limit | |
$derivation | Derivation | |
$outer | Environment |
Called from 2
Calls 2
- method-call Derivation::scalar() line 105
- new Environment line 105
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
SelectFactsTest::testAliasesAnswersTheFieldsWithAnExplicitAliasInOutputOrdercallsSelectFactsTest::testDeriveAnswersTheOutputAndRecordsEveryClausecallsSelectFactsTest::testDeriveMakesInputColumnsNullableInAnAggregateSelectionWithoutGroupBycallsSelectFactsTest::testLimitDerivesTheExpressionsWithoutTheColumnsOfTheSelectioncalls