classBlockRule
final class BlockRule
Lowers the query blocks of the 5.x grammars.
Rule: MYSQL-BLOCK-LEGACY-001. Scope: select_part2, select_options_and_item_list, table_expression (5.7); select_into, select_from, opt_select_from (5.6); create_select, create_view_select, select_part2_derived, select_init2_derived, select_derived2, select_derived_init (both). A block written with its clauses inside one rule is lowered to the same query block as in 8.0 and later: the ORDER BY, LIMIT, PROCEDURE ANALYSE, trailing INTO and locking clauses stay open until the block is known to be the last operand of a union (MYSQL-UNION-LEGACY-001). Constructs: the query block. Terminates: every part is a strict subtree. Source: https://dev.mysql.com/doc/refman/5.7/en/select.html, https://dev.mysql.com/doc/refman/5.6/en/select.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers the select options, the select list and the clauses after SELECT of a 5.x query block.
Parameters
$part | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:78
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:82
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:98
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::view() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:194
Calls 16
- method-call Lowering::form() line 53
- new TailRule line 54
- new ItemRule line 55
- method-call BlockRule::into() line 58
- method-call ItemRule::options() line 58
- method-call ItemRule::items() line 58
- new Trailer line 58
- method-call TailRule::locking() line 58
- method-call BlockRule::head() line 60
- new Block line 62
- method-call ClauseRule::ordering() line 62
- new ClauseRule line 62
- method-call TailRule::limit() line 62
- method-call TailRule::into() line 66
- method-call BlockRule::full() line 68
- static-call ImplementationGap::production() line 70
Lowers the 5.7 query block that writes a FROM clause.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleAnalysisException When PROCEDURE ANALYSE and INTO are both written (ER_WRONG_USAGE "PROCEDURE and INTO" of the 5.7 `select_part2` action, raised while parsing)Called from 1
Calls 17
- method-call BlockRule::head() line 82
- method-call Form::node() line 82
- new ClauseRule line 83
- new TailRule line 84
- method-call TailRule::into() line 85
- method-call TailRule::procedure() line 87
- new AnalysisException line 89
- new Block line 92
- method-call FromRule::from() line 96
- new FromRule line 96
- method-call ClauseRule::predicate() line 97
- method-call ClauseRule::grouping() line 98
- new Trailer line 102
- method-call ClauseRule::ordering() line 102
- method-call TailRule::limit() line 102
- method-call TailRule::locking() line 102
- class-const IntoPosition::AfterQuery() line 102
public function head(Node $head): array{list<SelectOption>, list<SelectExpression|Star|TableWildcard>}Lowers the select options and the select list of 5.7.
Parameters
$head | Node |
Returns
array{list<SelectOption>, list<SelectExpression|Star|TableWildcard>}Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::part() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:60
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::part() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:64
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::full() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:82
Calls 5
- method-call Lowering::form() line 114
- static-call ImplementationGap::production() line 116
- new ItemRule line 118
- method-call ItemRule::options() line 120
- method-call ItemRule::items() line 120
public function into(
Node $clauses,
list<SelectOption> $options,
list<SelectExpression|Star|TableWildcard> $items,
Trailer $lock,
): BlockLowers the 5.6 clauses after the select list.
Parameters
$clauses | Node | |
$options | list<SelectOption> | |
$items | list<SelectExpression|Star|TableWildcard> | |
$lock | Trailer |
Returns
Throws
ImplementationGap When a production has no ruleAnalysisException When PROCEDURE ANALYSE follows an INTO (ER_WRONG_USAGE "PROCEDURE and INTO" of the 5.6 `procedure_analyse_clause` action, which refuses a statement whose result is already set)Called from 1
Calls 13
- method-call Lowering::form() line 133
- new TailRule line 134
- new Block line 136
- method-call Trailer::then() line 136
- new Trailer line 136
- method-call ClauseRule::ordering() line 136
- new ClauseRule line 136
- method-call TailRule::limit() line 136
- method-call TailRule::into() line 137
- method-call BlockRule::from() line 138
- class-const IntoPosition::AfterQuery() line 140
- static-call ImplementationGap::production() line 141
- new AnalysisException line 144
public function from(
Node $from,
list<SelectOption> $options,
list<SelectExpression|Star|TableWildcard> $items,
?IntoDestination $into,
): BlockLowers the 5.6 FROM clause with the clauses that follow it.
Parameters
$from | Node | |
$options | list<SelectOption> | |
$items | list<SelectExpression|Star|TableWildcard> | |
$into | ?IntoDestination |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 4
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::into() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:138
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::into() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:139
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::into() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:140
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::optional() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:224
Calls 14
- method-call Lowering::form() line 159
- new ClauseRule line 160
- new TailRule line 161
- new Block line 164
- method-call FromRule::tables() line 168
- new FromRule line 168
- method-call ClauseRule::predicate() line 169
- method-call ClauseRule::grouping() line 170
- new Trailer line 174
- method-call ClauseRule::ordering() line 174
- method-call TailRule::limit() line 174
- method-call TailRule::procedure() line 174
- new Dual line 176
- static-call ImplementationGap::production() line 177
public function expression(
Node $expression,
list<SelectOption> $options,
list<SelectExpression|Star|TableWildcard> $items,
): BlockLowers the 5.7 table expression after a select list.
Parameters
$expression | Node | |
$options | list<SelectOption> | |
$items | list<SelectExpression|Star|TableWildcard> |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::create() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:241
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::derived() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:261
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:153
Calls 14
- method-call Lowering::form() line 190
- static-call ImplementationGap::production() line 192
- new ClauseRule line 194
- new TailRule line 195
- new Block line 197
- method-call FromRule::from() line 201
- new FromRule line 201
- method-call ClauseRule::predicate() line 202
- method-call ClauseRule::grouping() line 203
- new Trailer line 207
- method-call ClauseRule::ordering() line 207
- method-call TailRule::limit() line 207
- method-call TailRule::procedure() line 207
- method-call TailRule::locking() line 207
public function optional(
Node $from,
list<SelectOption> $options,
list<SelectExpression|Star|TableWildcard> $items,
): BlockLowers the 5.6 optional FROM clause of a derived or CREATE ... SELECT query block.
Parameters
$from | Node | |
$options | list<SelectOption> | |
$items | list<SelectExpression|Star|TableWildcard> |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::create() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:240
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::derived() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:260
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::derived() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:262
Calls 8
- method-call Lowering::form() line 220
- new Block line 223
- new Trailer line 223
- method-call TailRule::limit() line 223
- new TailRule line 223
- method-call BlockRule::from() line 224
- method-call TailRule::locking() line 224
- static-call ImplementationGap::production() line 225
Lowers the query block of CREATE TABLE ... SELECT and INSERT ... SELECT of 5.x.
Parameters
$select | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 2
- 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 7
- method-call Lowering::form() line 236
- new ItemRule line 237
- method-call BlockRule::optional() line 240
- method-call ItemRule::options() line 240
- method-call ItemRule::items() line 240
- method-call BlockRule::expression() line 241
- static-call ImplementationGap::production() line 242
Lowers the query block written directly after SELECT in a subquery or derived table of 5.x.
Returns
Throws
ImplementationGap When a production has no ruleAnalysisException When the block writes PROCEDURE ANALYSE (ER_WRONG_USAGE "PROCEDURE and subquery" of the 5.6 `procedure_analyse_clause` action and of 5.7 `PT_procedure_analyse::contextualize`, raised while parsing)Called from 6
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\BlockRule::derived() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/BlockRule.php:257
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:162
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:110
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:111
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:129
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:130
Calls 12
- method-call Lowering::form() line 254
- new ItemRule line 255
- method-call BlockRule::derived() line 257
- method-call BlockRule::optional() line 260
- method-call ItemRule::options() line 260
- method-call ItemRule::items() line 260
- new Trailer line 260
- method-call TailRule::locking() line 260
- new TailRule line 260
- method-call BlockRule::expression() line 261
- static-call ImplementationGap::production() line 261
- new AnalysisException line 266
Private surface 1§
Implementation details, listed for orientation only.
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
Relations§
Instantiated in 9
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:153
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:162
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:107
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:126
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:70
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:98
- new SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::view() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:194
- 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 12
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:153
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\FactorRule::content() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/FactorRule.php:162
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:110
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:111
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:129
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\SubqueryRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/SubqueryRule.php:130
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:78
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::operand() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:82
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::paren() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:98
- method-call SqlSemantics\Platform\MySql\Lowering\Query\Legacy\UnionRule::view() packages/sql-semantics-mysql/src/Lowering/Query/Legacy/UnionRule.php:194
- 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