classSubqueryRule
final class SubqueryRule
Lowers the subqueries of the 5.x grammars.
Rule: MYSQL-SUBQUERY-LEGACY-001. Scope: subselect, query_expression_body and query_specification (5.x), select_paren_derived. The query body is a left-recursive union walked in a loop and combined by MYSQL-UNION-LEGACY-001; an ORDER BY or LIMIT written after a parenthesized operand belongs to it. Constructs: the query block, SetOperation, ParenthesizedQuery, QueryExpression. Terminates: the union is walked in a loop; recursion follows nested parentheses. Source: https://dev.mysql.com/doc/refman/5.7/en/subqueries.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a 5.x subquery: a node of subselect.
Parameters
$subselect | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 3
- method-call Lowering::form() line 54
- method-call SubqueryRule::body() line 59
- static-call ImplementationGap::production() line 62
Lowers a 5.x query body, walking the union to its left in a loop.
Parameters
$body | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::subselect() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:59
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::subselect() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:65
Calls 9
- method-call Lowering::form() line 76
- new ExpressionRule line 77
- class-const SubqueryRule::UNIONS() line 78
- method-call ExpressionRule::quantifier() line 79
- method-call SubqueryRule::operand() line 79
- static-call ImplementationGap::production() line 85
- function-call
array_reverseline 89 - method-call Chain::query() line 94
- new Chain line 94
Lowers one operand of a 5.x query body with the ORDER BY or LIMIT written after it.
Throws
ImplementationGap When a production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::parens() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:102
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::body() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:79
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::body() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:83
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::body() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:84
Calls 8
- method-call Lowering::form() line 105
- new Trailer line 106
- method-call UnionRule::ordering() line 106
- new UnionRule line 106
- new BlockRule line 107
- method-call BlockRule::derived() line 110
- method-call SubqueryRule::paren() line 112
- static-call ImplementationGap::production() line 114
public function paren(Node $paren): ParenthesizedQueryLowers a parenthesized 5.x subquery operand, keeping its parentheses.
Parameters
$paren | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:112
- 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\SubqueryRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:131
Calls 6
- method-call Lowering::form() line 125
- new BlockRule line 126
- new ParenthesizedQuery line 128
- method-call BlockRule::derived() line 129
- method-call SubqueryRule::paren() line 131
- static-call ImplementationGap::production() line 132
Private surface 2§
Implementation details, listed for orientation only.
private const UNIONS = ['query_expression_body: query_expression_body UNION_SYM union_option query_spe…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
SubqueryRuleTestcalls