classSignal
final class Signal
implements Statement, ProgramStatement
uses Snapshot
Public API: explicitly declared with
@visibility public.SIGNAL: raises a condition.
The statement is valid on its own and inside a stored program, where a condition name and the names in the item values are resolved in the scope of the statement. The facts follow MYSQL-PROGRAM-CONDITIONS-001. Source: https://dev.mysql.com/doc/refman/8.4/en/signal.html.
$signal = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SIGNAL SQLSTATE VALUE '45000' SET MESSAGE_TEXT = 'no'");
[$signal->statement->condition->state->value, $signal->toString()] // => ['45000', "SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'no'"]Properties§
public list<SignalItem> $itemspublic ConditionName|SqlState $conditionMethods§
public function __construct(
public ConditionName|SqlState $condition,
list<SignalItem> $items = [],
)Parameters
$condition | ConditionName|SqlState | The condition raised: an SQLSTATE value or a condition name |
$items | list<SignalItem> | The condition information items of the SET clause; empty without SET |
Calls 2
- static-call Check::listOf() line 44
- class-const SignalItem::class() line 44
public function deriveStatement(Derivation $derivation): voidDerives the statement outside a stored program, where no condition name and no local variable is in scope.
Parameters
$derivation | Derivation |
Calls 3
- method-call Signal::deriveProgram() line 52
- new ProgramScope line 52
- method-call Derivation::environment() line 52
public function deriveProgram(Derivation $derivation, ProgramScope $scope): voidDerives the condition and the items in the scope of the statement.
Parameters
$derivation | Derivation | |
$scope | ProgramScope |
Called from 1
Calls 2
- method-call ConditionFacts::signal() line 60
- new ConditionFacts line 60
public function render(Output $out): voidTest cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 11
SignalRuleTest::testConditionLowersAConditionNamecallsSignalRuleTest::testConditionLowersAnSqlstateWithTheWordValuecallsSignalRuleTest::testItemsLowersAnAbsentClauseAsEmptycallsSignalRuleTest::testItemsLowersEveryItemNameInOrdercallsSignalRuleTest::testOperandLowersLiteralsVariablesAndNamescallsSignalRuleTest::testStatementLowersSignalcallsRoutineRulesTest::testStatementLowersSignalResignalAndGetDiagnosticscallsConditionFactsTest::testSignalResolvesTheValueOfAnItemToAParametercallsConditionNameTest::testRenderWritesTheNameASignalRaisescallsSignalItemTest::testRenderWritesEveryKindOfValuecallsSqlStateTest::testRenderDropsTheWordValuecalls