classUnionRule
final class UnionRule
Lowers the statements, views and unions of the 5.x grammars.
Rule: MYSQL-QUERY-LEGACY-001. Scope: select, select_init, select_init2, select_paren, union_clause, opt_union_clause, union_list, union_opt, opt_union_order_or_limit, union_order_or_limit, order_or_limit, view_select_aux, create_view_select_paren, create_view_select, and the union that follows create_select. The grammar nests a union to the right; it is walked in a loop and combined by MYSQL-UNION-LEGACY-001. Parenthesized selects are parenthesized queries. Constructs: the query block, SetOperation, ParenthesizedQuery, QueryExpression, QueryStatement. Terminates: the union is walked in a loop; recursion follows nested parentheses, which are strict subtrees. Source: https://dev.mysql.com/doc/refman/5.7/en/union.html, https://dev.mysql.com/doc/refman/5.7/en/create-view.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a 5.x query statement: a node of select.
Parameters
$select | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- method-call Lowering::form() line 52
- static-call ImplementationGap::production() line 54
- method-call UnionRule::operand() line 56
- method-call UnionRule::chain() line 58
Lowers one operand of a statement-level union and answers it with the node of the union that follows it.
Parameters
$init | Node |
Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::statement() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:56
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::chain() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:132
Calls 6
- method-call Lowering::form() line 69
- new BlockRule line 70
- static-call ImplementationGap::production() line 75
- method-call BlockRule::part() line 78
- new ParenthesizedQuery line 80
- method-call UnionRule::paren() line 80
Lowers the query inside the parentheses of a statement-level select.
Parameters
$paren | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:80
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:99
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::viewQuery() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:177
Calls 7
- method-call Lowering::form() line 95
- method-call BlockRule::part() line 98
- new BlockRule line 98
- new ParenthesizedQuery line 99
- method-call UnionRule::paren() line 99
- method-call UnionRule::view() line 100
- static-call ImplementationGap::production() line 101
Combines a first operand with the union written after it.
Returns
Throws
ImplementationGap When a production has no ruleCalled from 5
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::statement() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:58
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::viewQuery() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:176
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::viewQuery() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:177
- method-call SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::legacyQuery() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:107
- method-call SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::legacyParenthesizedQuery() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:120
Calls 9
- new Trailer line 112
- new ExpressionRule line 115
- method-call Lowering::form() line 117
- static-call ImplementationGap::production() line 129
- method-call ExpressionRule::quantifier() line 131
- method-call UnionRule::operand() line 132
- method-call UnionRule::ordering() line 136
- method-call Chain::query() line 144
- new Chain line 144
Lowers the ORDER BY and LIMIT written after a parenthesized operand; an absent clause is empty.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 5
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::parens() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:108
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:106
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:113
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::chain() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:136
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::ordering() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:159
Calls 8
- method-call Lowering::form() line 154
- new TailRule line 155
- new Trailer line 158
- method-call UnionRule::ordering() line 159
- method-call ClauseRule::ordering() line 160
- new ClauseRule line 160
- method-call TailRule::limit() line 160
- static-call ImplementationGap::production() line 162
Lowers the query of a 5.x view definition: a node of view_select_aux.
Parameters
$aux | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 6
- method-call Lowering::form() line 173
- method-call UnionRule::chain() line 176
- method-call UnionRule::view() line 176
- new ParenthesizedQuery line 177
- method-call UnionRule::paren() line 177
- static-call ImplementationGap::production() line 178
Lowers the query block of a 5.x view definition.
Parameters
$select | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:100
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::viewQuery() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:176
Calls 4
- method-call Lowering::form() line 189
- static-call ImplementationGap::production() line 191
- method-call BlockRule::part() line 194
- new BlockRule line 194
Private surface 1§
Implementation details, listed for orientation only.
private Lowering $loweringTest 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 7
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::parens() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:108
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:106
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:113
- new SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::query() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:87
- new SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::query() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:94
- new SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::legacyQuery() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:107
- new SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::legacyParenthesizedQuery() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:120
Method calls 7
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::parens() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:108
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:106
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:113
- method-call SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::query() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:87
- method-call SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::query() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:94
- method-call SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::legacyQuery() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:107
- method-call SqlSemantics\Platform\MySql\Lowering\Query\QueryRules::legacyParenthesizedQuery() packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:120