classBlockRule
final class BlockRule
Lowers BEGIN ... END blocks, their declarations and the cursor statements.
Rule: MYSQL-PROGRAM-BLOCK-LOWERING-001. Scope: sp_labeled_block, sp_unlabeled_block, sp_block_content, sp_decls, sp_decl, sp_decl_idents, sp_opt_default, sp_handler_type, sp_proc_stmt_open, sp_proc_stmt_fetch, sp_proc_stmt_close, sp_opt_fetch_noise, sp_fetch_list. The words NEXT FROM and FROM of FETCH hold no operand. Constructs: Block, VariableDeclaration, ConditionDeclaration, CursorDeclaration, HandlerDeclaration, OpenCursor, FetchCursor, CloseCursor. Terminates: every child is a strict subtree; lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/begin-end.html, https://dev.mysql.com/doc/refman/8.4/en/declare.html, https://dev.mysql.com/doc/refman/8.4/en/cursors.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a block: the form of sp_labeled_block or sp_unlabeled_block.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 11
- method-call Form::node() line 72
- method-call FlowRule::endLabel() line 73
- new FlowRule line 73
- static-call ImplementationGap::production() line 74
- method-call Lowering::form() line 76
- method-call Sequence::items() line 81
- new Sequence line 81
- method-call BlockRule::declaration() line 82
- new Block line 85
- method-call StatementRule::statements() line 85
- new StatementRule line 85
public function declaration(Node $declaration): DeclarationLowers one DECLARE: a node of sp_decl.
Parameters
$declaration | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 16
- method-call Lowering::form() line 95
- new ParameterRule line 96
- method-call ParameterRule::declared() line 99
- new VariableDeclaration line 101
- method-call BlockRule::names() line 101
- method-call BlockRule::initial() line 101
- new ConditionDeclaration line 107
- method-call ConditionRule::value() line 107
- new ConditionRule line 107
- new HandlerDeclaration line 111
- class-const BlockRule::ACTIONS() line 112
- static-call ImplementationGap::production() line 112
- method-call ConditionRule::handled() line 113
- method-call StatementRule::statement() line 114
- new StatementRule line 114
- new CursorDeclaration line 118
Lowers a comma-separated list of names: a node of sp_decl_idents or sp_fetch_list.
Parameters
$list | Node | |
$rule | string |
Returns
list<Name>Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::declaration() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:101
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::declaration() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:105
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::cursor() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:169
Calls 2
- method-call Sequence::items() line 133
- new Sequence line 133
Lowers the DEFAULT clause of a variable declaration: a node of sp_opt_default; an absent clause is null.
Parameters
$default | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::declaration() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:101
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::declaration() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:105
Calls 2
- method-call Lowering::form() line 147
- static-call ImplementationGap::production() line 152
public function cursor(Form $form): OpenCursor|FetchCursor|CloseCursorLowers OPEN, FETCH or CLOSE: the form of sp_proc_stmt_open, sp_proc_stmt_fetch or sp_proc_stmt_close.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 8
- method-call Lowering::form() line 164
- method-call Form::node() line 164
- class-const BlockRule::FETCH_WORDS() line 165
- static-call ImplementationGap::production() line 166
- new FetchCursor line 169
- method-call BlockRule::names() line 169
- new OpenCursor line 173
- new CloseCursor line 174
Private surface 3§
Implementation details, listed for orientation only.
private const ACTIONS = ['sp_handler_type: EXIT_SYM' => \SqlSemantics\Platform\MySql\Statement\Routine\…private const FETCH_WORDS = ['sp_opt_fetch_noise:' => true, 'sp_opt_fetch_noise: NEXT_SYM FROM' => true, 's…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 1
Method calls 2
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:90
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statement() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:91