classProjection
final class Projection
Derives the output fields of a result column list.
Rule: SQLITE-PROJECTION-001. A result column is named by SQLITE-RESULT-NAME-001 for the rows a statement returns: by its alias, by the column a column reference denotes, or by the span of its expression. * contributes every column of every input relation except the columns merged away by USING and NATURAL joins; t.* contributes every column of the relations the qualifier names. A relation whose columns are not all known contributes its known columns and an open star that names the missing inputs. A star without any input relation and a qualifier that names no input relation are reported, as is a result column that is a row value, which has no single value. Terminates: one pass over the list. Source: https://sqlite.org/c3ref/column_name.html, https://sqlite.org/lang_select.html#generation_of_the_set_of_result_rows. Status: Implemented.
Methods§
public function items(
list<ResultColumn|Star|TableStar> $columns,
Derivation $derivation,
Environment $environment,
): list<Field|OpenStar>Derives the result columns where the given environment is visible.
Parameters
$columns | list<ResultColumn|Star|TableStar> | |
$derivation | Derivation | |
$environment | Environment |
Test cases 3
Called from 2
Calls 18
- method-call Derivation::scalar() line 59
- method-call Derivation::report() line 61
- new Misuse line 61
- class-const MisuseRule::TooManyValueColumns() line 61
- method-call ColumnFacts::denoted() line 63
- new ColumnFacts line 63
- new ResultNames line 65
- new Field line 66
- function-call
countline 66 - new OutputSlot line 66
- method-call ResultNames::output() line 66
- method-call ResultNames::unnamed() line 66
- method-call ColumnResolver::admits() line 71
- new ColumnResolver line 71
- new QualifiedName line 71
- new MissingTable line 76
- class-const MisuseRule::StarWithoutTables() line 76
- method-call Projection::expand() line 79
public function expand(
list<Field|OpenStar> $items,
VisibleRelation $relation,
bool $merged,
): list<Field|OpenStar>Appends the columns a star selects from one relation.
Parameters
$items | list<Field|OpenStar> | |
$relation | VisibleRelation | |
$merged | bool |
Test cases 2
Called from 1
Calls 6
- function-call
in_arrayline 95 - new Field line 96
- function-call
countline 96 - new OutputSlot line 96
- new ResolvedColumn line 96
- new OpenStar line 100
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ProjectionTest::testExpandAppendsAnOpenStarForAnIncompleteRelationcallsProjectionTest::testExpandSkipsTheHiddenColumnsOnlyWhenMergedcallsProjectionTest::testItemsNamesEveryKindOfResultColumncallsProjectionTest::testItemsReportsARowValueResultColumncallsProjectionTest::testItemsReportsAStarWithoutInputAndAQualifierThatNamesNoRelationcalls