classConditionFacts
final class ConditionFacts
Derives condition values, SIGNAL and RESIGNAL, and the targets of GET DIAGNOSTICS.
Rule: MYSQL-PROGRAM-CONDITIONS-001. An SQLSTATE value is five digits or upper-case letters and does not begin with 00, which means success (ER_SP_BAD_SQLSTATE); an error code is not 0 (ER_WRONG_VALUE). Two condition values are the same when they are the same general condition, the same error number or the same SQLSTATE value; a condition name stands for the value it is declared for. A condition name must be declared around the statement (ER_SP_COND_MISMATCH); SIGNAL and RESIGNAL accept only a name declared for an SQLSTATE value (ER_SIGNAL_BAD_CONDITION_TYPE). Each condition information item is set at most once (ER_DUP_SIGNAL_SET); its value is derived in the scope of the statement, where a name is a parameter or local variable. A target of GET DIAGNOSTICS is a user variable or a parameter or local variable in scope (ER_SP_UNDECLARED_VAR). Terminates: the lists are finite. Source: https://dev.mysql.com/doc/refman/8.4/en/declare-condition.html, https://dev.mysql.com/doc/refman/8.4/en/signal.html, https://dev.mysql.com/doc/refman/8.4/en/get-diagnostics.html. Status: Implemented.
Methods§
public function value(Condition $value, Derivation $derivation, ProgramScope $scope): voidChecks a condition value: the form of an SQLSTATE value, the declaration of a condition name.
Parameters
$value | Condition | |
$derivation | Derivation | |
$scope | ProgramScope |
Called from 3
- method-call SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::derive() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:67
- method-call SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::handled() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:126
- method-call SqlSemantics\Platform\MySql\Rules\Routine\ConditionFacts::signal() packages/sql-semantics-mysql/src/Rules/Routine/ConditionFacts.php:89
Calls 7
- method-call Condition::valid() line 49
- method-call Derivation::report() line 50
- new ProgramProblem line 50
- class-const ProgramRule::ZeroErrorCode() line 50
- class-const ProgramRule::BadSqlState() line 53
- method-call ProgramScope::condition() line 55
- class-const ProgramRule::UndefinedCondition() line 56
public function meaning(Condition $value, ProgramScope $scope): ?ConditionAnswers the value a condition stands for: the declared value of a condition name, null for an undeclared name.
Parameters
$value | Condition | |
$scope | ProgramScope |
Returns
Test cases 1
Called from 1
Calls 1
- method-call ProgramScope::condition() line 65
Tells whether two condition values, names already replaced by their meaning, are the same.
Returns
boolTest cases 1
Called from 1
Calls 1
- method-call Condition::number() line 75
public function signal(
ConditionName|SqlState|null $condition,
list<SignalItem> $items,
Derivation $derivation,
ProgramScope $scope,
): voidDerives the condition and the information items of SIGNAL or RESIGNAL.
Parameters
$condition | ConditionName|SqlState|null | |
$items | list<SignalItem> | |
$derivation | Derivation | |
$scope | ProgramScope |
Called from 2
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Condition\Resignal::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Resignal.php:60
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Condition\Signal::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Signal.php:60
Calls 8
- method-call ConditionFacts::value() line 89
- method-call ProgramScope::condition() line 91
- method-call Derivation::report() line 92
- new ProgramProblem line 92
- class-const ProgramRule::SignalConditionKind() line 92
- function-call
in_arrayline 96 - class-const ProgramRule::DuplicateSignalItem() line 97
- method-call Derivation::scalar() line 100
public function targets(
list<InformationItem> $items,
Derivation $derivation,
ProgramScope $scope,
): voidDerives the targets of GET DIAGNOSTICS.
Parameters
$items | list<InformationItem> | |
$derivation | Derivation | |
$scope | ProgramScope |
Called from 1
Calls 3
- method-call Derivation::scalar() line 113
- method-call CursorFacts::variables() line 115
- new CursorFacts line 115
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Relations§
Instantiated in 5
- new SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::derive() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:67
- new SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::handled() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:125
- new SqlSemantics\Platform\MySql\Statement\Routine\Condition\Diagnostics\GetDiagnostics::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Diagnostics/GetDiagnostics.php:55
- new SqlSemantics\Platform\MySql\Statement\Routine\Condition\Resignal::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Resignal.php:60
- new SqlSemantics\Platform\MySql\Statement\Routine\Condition\Signal::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Signal.php:60
Method calls 7
- method-call SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::derive() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:67
- method-call SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::handled() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:126
- method-call SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::handled() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:127
- method-call SqlSemantics\Platform\MySql\Rules\Routine\BlockFacts::handled() packages/sql-semantics-mysql/src/Rules/Routine/BlockFacts.php:132
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Condition\Diagnostics\GetDiagnostics::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Diagnostics/GetDiagnostics.php:55
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Condition\Resignal::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Resignal.php:60
- method-call SqlSemantics\Platform\MySql\Statement\Routine\Condition\Signal::deriveProgram() packages/sql-semantics-mysql/src/Statement/Routine/Condition/Signal.php:60