classFromScope
final class FromScope
Derives the terms of a FROM clause and the relations they make visible to names.
Rule: MYSQL-FROM-SCOPE-001. A table reference, a derived table and a JSON table are each one visible relation under their correlation name, or a table reference under its table name when it has none, together with the INVISIBLE columns a name finds (MYSQL-TABLE-SHAPES-001); DUAL makes none visible. A non-lateral derived table sees the enclosing queries only; a LATERAL derived table and the document of JSON_TABLE also see the tables to their left: the earlier members of the comma list and, inside a join, the left operand. A join combines its operands by MYSQL-JOIN-COLUMNS-001 and derives its ON condition where exactly its two operands are visible, before NULL extension. Parentheses, braces and comma lists group terms and change no name. Terminates: comma lists are walked in a loop; recursion follows the strictly smaller operands. Source: https://dev.mysql.com/doc/refman/8.4/en/join.html, https://dev.mysql.com/doc/refman/8.4/en/lateral-derived-tables.html, https://dev.mysql.com/doc/refman/8.4/en/json-table-functions.html. Status: Implemented.
Methods§
public function open(
Relation $term,
Derivation $derivation,
Environment $outer,
list<VisibleRelation> $left,
): JoinedInputDerives one term, records its facts and answers what it makes visible.
Parameters
$term | Relation | |
$derivation | Derivation | |
$outer | Environment | |
$left | list<VisibleRelation> | The relations to the left of the term in its FROM clause |
Returns
Called from 6
- method-call SqlSemantics\Platform\MySql\Rules\Dml\ChangeFacts::references() packages/sql-semantics-mysql/src/Rules/Dml/ChangeFacts.php:144
- method-call SqlSemantics\Platform\MySql\Rules\Query\From\FromScope::enter() packages/sql-semantics-mysql/src/Rules/Query/From/FromScope.php:87
- method-call SqlSemantics\Platform\MySql\Rules\Query\From\FromScope::enter() packages/sql-semantics-mysql/src/Rules/Query/From/FromScope.php:98
- method-call SqlSemantics\Platform\MySql\Rules\Query\From\FromScope::enter() packages/sql-semantics-mysql/src/Rules/Query/From/FromScope.php:99
- method-call SqlSemantics\Platform\MySql\Rules\Query\From\FromScope::enter() packages/sql-semantics-mysql/src/Rules/Query/From/FromScope.php:107
- method-call SqlSemantics\Platform\MySql\Rules\Query\SelectFacts::derive() packages/sql-semantics-mysql/src/Rules/Query/SelectFacts.php:61
Calls 11
- method-call FromScope::enter() line 54
- method-call Derivation::target() line 55
- method-call Derivation::relation() line 60
- new Environment line 60
- new VisibleRelation line 62
- method-call Relation::alias() line 62
- method-call Relation::name() line 62
- method-call TableShapes::implicit() line 62
- new TableShapes line 62
- new JoinedInput line 66
- function-call
array_keysline 69
public function enter(
TableList|JoinedTable|NestedRelation|OdbcJoin|EscapedRelation $term,
Derivation $derivation,
Environment $outer,
list<VisibleRelation> $left,
): JoinedInputDerives the terms of a grouping term without recording the facts of the term itself.
Parameters
$term | TableList|JoinedTable|NestedRelation|OdbcJoin|EscapedRelation | |
$derivation | Derivation | |
$outer | Environment | |
$left | list<VisibleRelation> | The relations to the left of the term in its FROM clause |
Returns
Called from 6
- method-call SqlSemantics\Platform\MySql\Rules\Query\From\FromScope::open() packages/sql-semantics-mysql/src/Rules/Query/From/FromScope.php:54
- method-call SqlSemantics\Platform\MySql\Statement\Relation\EscapedRelation::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/EscapedRelation.php:46
- method-call SqlSemantics\Platform\MySql\Statement\Relation\JoinedTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/JoinedTable.php:73
- method-call SqlSemantics\Platform\MySql\Statement\Relation\NestedRelation::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/NestedRelation.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Relation\OdbcJoin::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/OdbcJoin.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Relation\TableList::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/TableList.php:59
Calls 10
- method-call FromScope::open() line 87
- function-call
countline 88 - function-call
array_pushline 89 - static-call JoinedInput::of() line 95
- method-call Operands::single() line 101
- new Operands line 101
- method-call Derivation::scalar() line 101
- new Environment line 101
- method-call Joining::join() line 104
- new Joining line 104
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
FromScopeTestcalls
Relations§
Instantiated in 7
- new SqlSemantics\Platform\MySql\Rules\Dml\ChangeFacts::references() packages/sql-semantics-mysql/src/Rules/Dml/ChangeFacts.php:142
- new SqlSemantics\Platform\MySql\Rules\Query\SelectFacts::derive() packages/sql-semantics-mysql/src/Rules/Query/SelectFacts.php:61
- new SqlSemantics\Platform\MySql\Statement\Relation\EscapedRelation::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/EscapedRelation.php:46
- new SqlSemantics\Platform\MySql\Statement\Relation\JoinedTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/JoinedTable.php:73
- new SqlSemantics\Platform\MySql\Statement\Relation\NestedRelation::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/NestedRelation.php:44
- new SqlSemantics\Platform\MySql\Statement\Relation\OdbcJoin::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/OdbcJoin.php:44
- new SqlSemantics\Platform\MySql\Statement\Relation\TableList::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/TableList.php:59
Method calls 7
- method-call SqlSemantics\Platform\MySql\Rules\Dml\ChangeFacts::references() packages/sql-semantics-mysql/src/Rules/Dml/ChangeFacts.php:144
- method-call SqlSemantics\Platform\MySql\Rules\Query\SelectFacts::derive() packages/sql-semantics-mysql/src/Rules/Query/SelectFacts.php:61
- method-call SqlSemantics\Platform\MySql\Statement\Relation\EscapedRelation::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/EscapedRelation.php:46
- method-call SqlSemantics\Platform\MySql\Statement\Relation\JoinedTable::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/JoinedTable.php:73
- method-call SqlSemantics\Platform\MySql\Statement\Relation\NestedRelation::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/NestedRelation.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Relation\OdbcJoin::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/OdbcJoin.php:44
- method-call SqlSemantics\Platform\MySql\Statement\Relation\TableList::deriveRelation() packages/sql-semantics-mysql/src/Statement/Relation/TableList.php:59