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

PREPARE: names a statement whose text is given as a string or held by a user variable.

Rule: MYSQL-PREPARE-001. The text is SQL the server parses when it runs PREPARE; it is kept as the string it is, because the request is to prepare that text, and a text held by a user variable is a session value. A user variable is derived as a session value. The statement returns no rows. Terminates: no nested statement is lowered. Source: https://dev.mysql.com/doc/refman/8.4/en/prepare.html. Status: Implemented.

Reading a PREPAREdoctest
$prepare = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("PREPARE stmt FROM 'SELECT ?'");
    [$prepare->statement->name->value, $prepare->statement->source->value, $prepare->toString()] // => ['stmt', 'SELECT ?', "PREPARE stmt FROM 'SELECT ?'"]

Properties§

public Name $name
public Text|UserVariable $source

Methods§

public function __construct(public Name $name, public Text|UserVariable $source)

Parameters

$nameNameThe name of the prepared statement
$sourceText|UserVariableThe statement text, or the user variable that holds it
public function deriveStatement(Derivation $derivation): void

Derives the user variable that holds the text, when there is one; the statement returns no rows.

Parameters

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

Writes the statement.

Parameters

$outOutput
Calls 2

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Type checks 1