final class HandlerDeclaration
    implements Declaration
    uses Snapshot
Public API: explicitly declared with @visibility public.

DECLARE ... HANDLER: the statement that runs when one of the listed conditions occurs in the block.

Source: https://dev.mysql.com/doc/refman/8.4/en/declare-handler.html.

Reading a handlerdoctest
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE PROCEDURE p() BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND, 1051 BEGIN END; END');
    $handler = $create->statement->body->declarations[0];
    [$handler->action, count($handler->conditions)] // => [\SqlSemantics\Platform\MySql\Statement\Routine\Program\HandlerAction::Continue, 2]

Properties§

public non-empty-list<Condition> $conditions
public HandlerAction $action

Methods§

public function __construct(
    public HandlerAction $action,
    list<Condition> $conditions,
    Node $statement,
)

Parameters

$actionHandlerActionWhat happens after the handler ran
$conditionslist<Condition>The conditions handled; at least one
$statementNodeThe statement the handler runs: a program statement or an SQL statement

Throws

InvalidConstruction When there is no condition or the statement is of another class
Calls 4
public function render(Output $out): void

Writes the declaration.

Parameters

$outOutput
Calls 1

Test cases 15§

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 12

Relations§

Instantiated in 1
Type checks 2