classRaise
final class Raise
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.The RAISE function of a trigger program: abandon the current row, or fail with a message.
Rule: SQLITE-RAISE-001. RAISE(IGNORE) takes no message; every other action takes one. The function yields no value to the expression around it; its facts are those of an absent value. Source: https://sqlite.org/lang_createtrigger.html#the_raise_function. Status: Implemented.
$trigger = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze("CREATE TRIGGER r BEFORE DELETE ON t BEGIN SELECT RAISE(FAIL, 'no'); END");
$trigger->statement->steps[0]->columns[0]->expression->message->value // => 'no'new \SqlSemantics\Platform\Sqlite\Statement\Expression\Raise(\SqlSemantics\Platform\Sqlite\Statement\Expression\RaiseAction::Ignore, new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\TextLiteral('x')) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstructionnew \SqlSemantics\Platform\Sqlite\Statement\Expression\Raise(\SqlSemantics\Platform\Sqlite\Statement\Expression\RaiseAction::Fail) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstructionProperties§
public RaiseAction $actionpublic Scalar|null $message = nullMethods§
public function __construct(public RaiseAction $action, public Scalar|null $message = null)Parameters
$action | RaiseAction | The action |
$message | Scalar|null | The error message; absent exactly for IGNORE |
Calls 2
- static-call Check::input() line 45
- class-const RaiseAction::Ignore() line 45
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the message; the function itself yields no value.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- method-call Derivation::scalar() line 54
- new ScalarFact line 57
- new NullOnly line 57
- class-const Nullability::Nullable() line 57
public function render(Output $out): voidWrites the function.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 65
- method-call Output::symbol() line 67
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 4
Relations§
Instantiated in 2
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:78
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:79