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.

Reading the message of a RAISEdoctest
$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'
Refusing a message for IGNOREdoctest
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\InvalidConstruction
Refusing a missing message for faildoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Raise(\SqlSemantics\Platform\Sqlite\Statement\Expression\RaiseAction::Fail) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public RaiseAction $action
public Scalar|null $message = null

Methods§

public function __construct(public RaiseAction $action, public Scalar|null $message = null)

Parameters

$actionRaiseActionThe action
$messageScalar|nullThe error message; absent exactly for IGNORE
Calls 2
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the message; the function itself yields no value.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 4
public function render(Output $out): void

Writes the function.

Parameters

$outOutput
Calls 2

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
Constant reads 1
Type checks 1