classDerivedShapes
final class DerivedShapes
Derives the row shape of a derived table or a common table from its query and its column list.
Rule: MYSQL-DERIVED-SHAPES-001. Without a column list the columns are the output slots of the query, with their names (MYSQL-SELECT-ITEM-NAME-001); a slot whose name depends on missing inputs keeps them as its unnamed inputs, so that a column lookup in the relation depends on them (CORE-COLUMN-LOOKUP-001). With a column list the list names the columns in order and the query gives their types, which depend on the missing inputs of the query while its columns are not all known; a list whose length differs from a complete query is reported, and a column without a slot is invalid. Duplicate column names are reported. Source: https://dev.mysql.com/doc/refman/8.4/en/derived-tables.html, https://dev.mysql.com/doc/refman/8.4/en/with.html. Status: Implemented.
Methods§
public function shape(QueryFact $fact, list<Name> $columns, Derivation $derivation): RowShapeAnswers the shape of the rows the query produces under the given column names.
Parameters
$fact | QueryFact | |
$columns | list<Name> | The column list; empty when the query names the columns |
$derivation | Derivation |
Returns
Test cases 1
Called from 2
Calls 10
- new OutputSlot line 50
- method-call DerivedShapes::unique() line 52
- new RowShape line 54
- function-call
countline 57 - new CountMismatch line 58
- class-const CountedList::DerivedColumns() line 58
- method-call Derivation::report() line 59
- new Invalid line 67
- class-const Nullability::Dependent() line 67
- new Dependent line 69
public function unique(list<OutputSlot> $slots, Derivation $derivation): voidReports a column name that occurs twice.
Parameters
$slots | list<OutputSlot> | |
$derivation | Derivation |
Test cases 1
Called from 2
Calls 3
- method-call Derivation::report() line 91
- new Misuse line 91
- class-const MisuseRule::DuplicateColumn() line 91
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.