final class CreateProcedure
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

CREATE PROCEDURE: a stored procedure with its parameters, characteristics and body.

The statement is structured as a request: it declares nothing to a context. The facts follow MYSQL-ROUTINE-001. Source: https://dev.mysql.com/doc/refman/8.4/en/create-procedure.html.

Reading a procedure definitiondoctest
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE PROCEDURE shop.p(IN a INT) DETERMINISTIC SELECT a');
    [$create->statement->name->name->value, count($create->statement->parameters->parameters), $create->toString()] // => ['p', 1, 'CREATE PROCEDURE shop.p(IN a INT) DETERMINISTIC SELECT a']

Properties§

public list<Characteristic> $characteristics
public ParameterList $parameters
public Account|null $definer = null
public bool $ifNotExists = false

Methods§

public function __construct(
    public QualifiedName $name,
    public ParameterList $parameters,
    Node $body,
    list<Characteristic> $characteristics = [],
    public Account|null $definer = null,
    public bool $ifNotExists = false,
)

Parameters

$nameQualifiedNameThe procedure name with its optional database
$parametersParameterListThe parameters
$bodyNodeThe body: a program statement, an SQL statement, or external code
$characteristicslist<Characteristic>The characteristics in written order
$definerAccount|nullThe DEFINER clause, when written
$ifNotExistsboolWhether IF NOT EXISTS is written (MySQL 8.0.29 and later)

Throws

InvalidConstruction When the body or a characteristic is of another class
Calls 5
public function deriveStatement(Derivation $derivation): void

Derives the parameters and the body.

Parameters

$derivationDerivation
Calls 3
public function render(Output $out): void

Writes the statement.

Parameters

$outOutput
Calls 5

Test cases 75§

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 72

Relations§

Instantiated in 1
Type checks 1
Type declarations 1