classTableShapes
final class TableShapes
Derives the row shape of a named table occurrence.
Rule: MYSQL-TABLE-SHAPES-001. An unqualified name that a common table expression in scope defines denotes it, the innermost first; any other name resolves by CORE-TABLE-LOOKUP-001 in the current database or the database written. A declared table contributes one slot per declared column, in order, each referring to the declaration; a common table contributes the slots of its definition; an undeclared or conditionally resolved name contributes an open shape that names the missing declaration; a missing or conflicting name contributes an empty complete shape and the diagnostic. The INVISIBLE columns of a declared table are no slots of the shape, so * and the TABLE statement do not select them, but a name finds them on the occurrence. Source: https://dev.mysql.com/doc/refman/8.4/en/invisible-columns.html ("not part of SELECT *", "can be referenced explicitly"),
- https://dev.mysql.com/doc/refman/8.4/en/with.html ("a CTE name ...
takes precedence over a table of the same name"), https://dev.mysql.com/doc/refman/8.4/en/join.html. Status: Implemented.
Methods§
public function named(
QualifiedName $name,
Derivation $derivation,
Environment $environment,
): RelationFactResolves a table name and answers the facts of its occurrence.
Parameters
$name | QualifiedName | |
$derivation | Derivation | |
$environment | Environment |
Returns
Called from 5
- method-call SqlSemantics\Platform\MySql\Statement\Dml\Handler\HandlerOpen::deriveStatement() packages/sql-semantics-mysql/src/Statement/Dml/Handler/HandlerOpen.php:54
- method-call SqlSemantics\Platform\MySql\Statement\Dml\WriteTarget::deriveRelation() packages/sql-semantics-mysql/src/Statement/Dml/WriteTarget.php:82
- method-call SqlSemantics\Platform\MySql\Statement\Query\ExplicitTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Query/ExplicitTable.php:86
- method-call SqlSemantics\Platform\MySql\Statement\Relation\TableReference::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/TableReference.php:100
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Trigger\TriggerTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Routine/Trigger/TriggerTable.php:50
Calls 6
- method-call Derivation::table() line 54
- new OutputSlot line 58
- new Known line 58
- new RelationFact line 61
- new RowShape line 61
- method-call Environment::commonTable() line 64
public function implicit(RelationFact $fact): list<ImplicitSlot>Answers the columns of a declared table that a name finds although * does not select them: the INVISIBLE columns.
Parameters
$fact | RelationFact |
Returns
list<ImplicitSlot>Test cases 1
Called from 2
Calls 3
- new ImplicitSlot line 84
- new OutputSlot line 84
- new Known line 84
public function explicit(
ExplicitTable $table,
RelationFact $fact,
Derivation $derivation,
): QueryFactAnswers the output of the TABLE statement: every column of its table, in order.
Parameters
$table | ExplicitTable | |
$fact | RelationFact | |
$derivation | Derivation |
Returns
Test cases 1
Called from 1
Calls 5
- new Field line 97
- new OutputSlot line 97
- new ResolvedColumn line 97
- new OpenStar line 100
- new QueryFact line 103
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Relations§
Instantiated in 8
- new SqlSemantics\Platform\MySql\Rules\Query\From\FromScope::open() packages/sql-semantics-mysql/src/Rules/Query/From/FromScope.php:62
- new SqlSemantics\Platform\MySql\Rules\Routine\RowAliases::visible() packages/sql-semantics-mysql/src/Rules/Routine/RowAliases.php:45
- new SqlSemantics\Platform\MySql\Statement\Dml\Handler\HandlerOpen::deriveStatement() packages/sql-semantics-mysql/src/Statement/Dml/Handler/HandlerOpen.php:54
- new SqlSemantics\Platform\MySql\Statement\Dml\WriteTarget::deriveRelation() packages/sql-semantics-mysql/src/Statement/Dml/WriteTarget.php:82
- new SqlSemantics\Platform\MySql\Statement\Query\ExplicitTable::deriveQuery() packages/sql-semantics-mysql/src/Statement/Query/ExplicitTable.php:78
- new SqlSemantics\Platform\MySql\Statement\Query\ExplicitTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Query/ExplicitTable.php:86
- new SqlSemantics\Platform\MySql\Statement\Relation\TableReference::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/TableReference.php:100
- new SqlSemantics\Platform\MySql\Statement\Routine\Trigger\TriggerTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Routine/Trigger/TriggerTable.php:50
Method calls 8
- method-call SqlSemantics\Platform\MySql\Rules\Query\From\FromScope::open() packages/sql-semantics-mysql/src/Rules/Query/From/FromScope.php:62
- method-call SqlSemantics\Platform\MySql\Rules\Routine\RowAliases::visible() packages/sql-semantics-mysql/src/Rules/Routine/RowAliases.php:45
- method-call SqlSemantics\Platform\MySql\Statement\Dml\Handler\HandlerOpen::deriveStatement() packages/sql-semantics-mysql/src/Statement/Dml/Handler/HandlerOpen.php:54
- method-call SqlSemantics\Platform\MySql\Statement\Dml\WriteTarget::deriveRelation() packages/sql-semantics-mysql/src/Statement/Dml/WriteTarget.php:82
- method-call SqlSemantics\Platform\MySql\Statement\Query\ExplicitTable::deriveQuery() packages/sql-semantics-mysql/src/Statement/Query/ExplicitTable.php:78
- method-call SqlSemantics\Platform\MySql\Statement\Query\ExplicitTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Query/ExplicitTable.php:86
- method-call SqlSemantics\Platform\MySql\Statement\Relation\TableReference::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/TableReference.php:100
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Trigger\TriggerTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Routine/Trigger/TriggerTable.php:50