classProgramRestrictions
final class ProgramRestrictions
Reports the statements a stored program may not contain.
Rule: MYSQL-PROGRAM-RESTRICTIONS-001. No stored program contains LOCK TABLES, UNLOCK TABLES, ALTER VIEW, LOAD DATA, LOAD XML or USE (ER_SP_BADSTATEMENT), a CREATE PROCEDURE, CREATE FUNCTION of a stored function or CREATE TRIGGER (ER_SP_NO_RECURSIVE_CREATE), an ALTER or DROP of a procedure or function (ER_SP_NO_DROP_SP), or a CREATE EVENT or an ALTER EVENT with a body (ER_EVENT_RECURSION_FORBIDDEN). A stored function or trigger in addition returns no result set: no query without INTO, no SHOW, EXPLAIN, DESCRIBE, HELP and no CHECK, ANALYZE, OPTIMIZE, REPAIR or CHECKSUM TABLE (ER_SP_NO_RETSET); performs no explicit commit or rollback (ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG); and uses no PREPARE, EXECUTE or DEALLOCATE PREPARE, no FLUSH and no RESET, RESET PERSIST included, which the grammar reads as the same RESET command (rule reset of sql_yacc.yy) (ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG). Limit: the implicit commit of a data definition statement in a stored function or trigger is not reported. Terminates: the INTO search descends into strict parts of a query. Source: https://dev.mysql.com/doc/refman/8.4/en/stored-program-restrictions.html, https://dev.mysql.com/doc/refman/8.4/en/create-procedure.html ("The USE statement is not permitted in stored routines"). Status: Implemented.
Methods§
public function check(Statement $statement, ProgramKind $kind, Derivation $derivation): voidReports a statement of a stored program of a kind that may not contain it.
Parameters
$statement | Statement | |
$kind | ProgramKind | |
$derivation | Derivation |
Called from 1
Calls 5
- method-call ProgramRestrictions::anywhere() line 85
- class-const ProgramKind::Function() line 86
- class-const ProgramKind::Trigger() line 86
- method-call ProgramRestrictions::function() line 87
- method-call Derivation::report() line 90
public function anywhere(Statement $statement): ?ProgramProblemAnswers the problem of a statement no stored program may contain.
Parameters
$statement | Statement |
Returns
Test cases 1
Called from 1
Calls 9
- new ProgramProblem line 100
- class-const ProgramRule::BadStatement() line 100
- class-const LoadFormat::Xml() line 103
- class-const ProgramRule::RecursiveCreate() line 105
- class-const ProgramKind::Procedure() line 105
- class-const ProgramKind::Function() line 106
- class-const ProgramKind::Trigger() line 107
- class-const ProgramRule::EventRecursion() line 108
- class-const ProgramRule::NestedAlterOrDrop() line 109
public function function(Statement $statement, ProgramKind $kind): ?ProgramProblemAnswers the problem of a statement a stored function or trigger may not contain.
Parameters
$statement | Statement | |
$kind | ProgramKind |
Returns
Test cases 1
Called from 1
Calls 6
- method-call ProgramRestrictions::results() line 121
- new ProgramProblem line 121
- class-const ProgramRule::ResultSet() line 121
- function-call
strtolowerline 121 - class-const ProgramRule::CommitInFunction() line 122
- class-const ProgramRule::FunctionStatement() line 123
public function results(Statement $statement): boolTells whether a statement returns a result set to the client.
Parameters
$statement | Statement |
Returns
boolTest cases 1
Called from 1
Calls 2
- method-call ProgramRestrictions::into() line 136
- function-call
str_starts_withline 141
public function into(Query|LeadingUnion $query): boolTells whether a query writes its rows INTO variables or a file instead of returning them.
Parameters
$query | Query|LeadingUnion |
Returns
boolTest cases 1
Called from 5
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ProgramRestrictions::results() packages/sql-semantics-mysql/src/Rules/Routine/ProgramRestrictions.php:136
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ProgramRestrictions::into() packages/sql-semantics-mysql/src/Rules/Routine/ProgramRestrictions.php:151
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ProgramRestrictions::into() packages/sql-semantics-mysql/src/Rules/Routine/ProgramRestrictions.php:152
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ProgramRestrictions::into() packages/sql-semantics-mysql/src/Rules/Routine/ProgramRestrictions.php:153
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ProgramRestrictions::into() packages/sql-semantics-mysql/src/Rules/Routine/ProgramRestrictions.php:154
Calls 1
- method-call ProgramRestrictions::into() line 151
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.