classCursorFacts
final class CursorFacts
Derives the cursor statements OPEN, FETCH and CLOSE.
Rule: MYSQL-PROGRAM-CURSORS-001. The cursor must be declared in an enclosing block (ER_SP_CURSOR_MISMATCH), and every target of FETCH must be a parameter or local variable in scope (ER_SP_UNDECLARED_VAR). Whether the cursor is open, and whether the number of targets equals the number of columns of the cursor query, is checked only when the program runs. Terminates: the lists are finite. Source: https://dev.mysql.com/doc/refman/8.4/en/cursors.html. Status: Implemented.
Methods§
public function cursor(Name $cursor, Derivation $derivation, ProgramScope $scope): voidReports a cursor that is not declared around the statement.
Parameters
$cursor | Name | |
$derivation | Derivation | |
$scope | ProgramScope |
Called from 3
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\CloseCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/CloseCursor.php:43
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\FetchCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/FetchCursor.php:52
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\OpenCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/OpenCursor.php:42
Calls 4
- method-call ProgramScope::holds() line 33
- method-call Derivation::report() line 34
- new ProgramProblem line 34
- class-const ProgramRule::UndefinedCursor() line 34
public function variables(
list<Name> $variables,
Derivation $derivation,
ProgramScope $scope,
): voidReports every name that is no parameter or local variable in scope.
Parameters
$variables | list<Name> | |
$derivation | Derivation | |
$scope | ProgramScope |
Called from 2
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ConditionFacts::targets() packages/sql-semantics-mysql/src/Rules/Routine/ConditionFacts.php:115
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\FetchCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/FetchCursor.php:53
Calls 4
- method-call ProgramScope::variable() line 46
- method-call Derivation::report() line 47
- new ProgramProblem line 47
- class-const ProgramRule::UndeclaredVariable() line 47
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CursorFactsTestcalls
Relations§
Instantiated in 5
- new SqlSemantics\Platform\MySql\Rules\Routine\ConditionFacts::targets() packages/sql-semantics-mysql/src/Rules/Routine/ConditionFacts.php:115
- new SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\CloseCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/CloseCursor.php:43
- new SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\FetchCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/FetchCursor.php:52
- new SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\FetchCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/FetchCursor.php:53
- new SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\OpenCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/OpenCursor.php:42
Method calls 5
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ConditionFacts::targets() packages/sql-semantics-mysql/src/Rules/Routine/ConditionFacts.php:115
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\CloseCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/CloseCursor.php:43
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\FetchCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/FetchCursor.php:52
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\FetchCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/FetchCursor.php:53
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Program\Cursor\OpenCursor::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Program/Cursor/OpenCursor.php:42