classStatementRule
final class StatementRule
Lowers the statements of stored programs and routes each to its rule.
Rule: MYSQL-PROGRAM-STATEMENT-LOWERING-001. Scope: sp_proc_stmt, ev_sql_stmt, ev_sql_stmt_inner, sp_proc_stmt_statement, sp_proc_stmt_unlabeled, sp_proc_stmts, sp_proc_stmts1, stored_routine_body, routine_string. An SQL statement inside a program re-enters the statement dispatcher. The semicolons that end the statements of a list are written back by the statement that holds the list. A dollar-quoted string is split into its tag and its text. Constructs: ExternalBody, DollarQuotedText. Terminates: every statement is a strict subtree; lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/sql-compound-statements.html, https://dev.mysql.com/doc/refman/9.1/en/create-procedure.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function statement(Node $statement): ProgramStatement|StatementLowers one statement of a program: a node of sp_proc_stmt or ev_sql_stmt_inner.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 6
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::declaration() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:114
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::statements() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:107
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::event() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:122
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::body() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:133
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\StatementRule::body() packages/sql-semantics-mysql/src/Lowering/Routine/Program/StatementRule.php:137
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\TriggerRule::create() packages/sql-semantics-mysql/src/Lowering/Routine/TriggerRule.php:95
Calls 13
- method-call Lowering::form() line 74
- class-const StatementRule::ALTERNATIVES() line 75
- static-call ImplementationGap::production() line 76
- new FlowRule line 79
- new BlockRule line 80
- method-call Lowering::statement() line 83
- method-call FlowRule::loop() line 84
- method-call FlowRule::jump() line 86
- method-call FlowRule::conditional() line 87
- method-call FlowRule::choice() line 88
- method-call FlowRule::labeled() line 89
- method-call BlockRule::block() line 90
- method-call BlockRule::cursor() line 91
public function statements(Node $list): list<ProgramStatement|Statement>Lowers a statement list: a node of sp_proc_stmts or sp_proc_stmts1.
Parameters
$list | Node |
Returns
list<ProgramStatement|Statement>Throws
ImplementationGap When a production has no ruleCalled from 8
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::block() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:85
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::conditional() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:79
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::conditional() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:86
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::choice() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:115
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::choice() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:120
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::loop() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:168
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::loop() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:169
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::loop() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:170
Calls 4
- method-call Sequence::items() line 106
- new Sequence line 106
- class-const StatementRule::LISTS() line 106
- method-call StatementRule::statement() line 107
public function event(Node $statement): ProgramStatement|StatementLowers the statement of an event: a node of ev_sql_stmt.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 2
Calls 3
- method-call Lowering::form() line 120
- method-call StatementRule::statement() line 122
- static-call ImplementationGap::production() line 122
public function body(Node $body): ExternalBody|ProgramStatement|StatementLowers a routine body: a node of sp_proc_stmt or stored_routine_body.
Parameters
$body | Node |
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 5
- method-call StatementRule::statement() line 133
- method-call Lowering::form() line 135
- static-call ImplementationGap::production() line 140
- new ExternalBody line 144
- method-call StatementRule::dollarQuoted() line 146
public function dollarQuoted(Token $token): DollarQuotedTextPrivate surface 3§
Implementation details, listed for orientation only.
private const ALTERNATIVES = ['sp_proc_stmt: sp_proc_stmt_statement' => true, 'sp_proc_stmt: sp_proc_stmt_re…private const LISTS = ['sp_proc_stmts:', 'sp_proc_stmts: sp_proc_stmts sp_proc_stmt ;', 'sp_proc_stmt…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\Routine\DefinitionRule::routine() packages/sql-semantics-mysql/src/Lowering/Routine/DefinitionRule.php:125
- new SqlSemantics\Platform\MySql\Lowering\Routine\EventRule::create() packages/sql-semantics-mysql/src/Lowering/Routine/EventRule.php:100
- new SqlSemantics\Platform\MySql\Lowering\Routine\EventRule::alter() packages/sql-semantics-mysql/src/Lowering/Routine/EventRule.php:148
- new SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::block() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:85
- new SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::declaration() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:114
- new SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::conditional() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:71
- new SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::choice() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:108
- new SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::loop() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:165
- new SqlSemantics\Platform\MySql\Lowering\Routine\TriggerRule::create() packages/sql-semantics-mysql/src/Lowering/Routine/TriggerRule.php:95
Method calls 13
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\DefinitionRule::routine() packages/sql-semantics-mysql/src/Lowering/Routine/DefinitionRule.php:125
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\EventRule::create() packages/sql-semantics-mysql/src/Lowering/Routine/EventRule.php:100
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\EventRule::alter() packages/sql-semantics-mysql/src/Lowering/Routine/EventRule.php:148
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::block() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:85
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\BlockRule::declaration() packages/sql-semantics-mysql/src/Lowering/Routine/Program/BlockRule.php:114
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::conditional() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:79
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::conditional() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:86
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::choice() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:115
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::choice() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:120
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::loop() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:168
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::loop() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:169
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\Program\FlowRule::loop() packages/sql-semantics-mysql/src/Lowering/Routine/Program/FlowRule.php:170
- method-call SqlSemantics\Platform\MySql\Lowering\Routine\TriggerRule::create() packages/sql-semantics-mysql/src/Lowering/Routine/TriggerRule.php:95