classPrepare
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.
$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 $namepublic Text|UserVariable $sourceMethods§
public function __construct(public Name $name, public Text|UserVariable $source)Parameters
$name | Name | The name of the prepared statement |
$source | Text|UserVariable | The statement text, or the user variable that holds it |
public function deriveStatement(Derivation $derivation): voidDerives the user variable that holds the text, when there is one; the statement returns no rows.
Parameters
$derivation | Derivation |
Calls 2
- method-call Derivation::scalar() line 49
- method-call Derivation::environment() line 49
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 58
- class-const NameUse::Label() line 58
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.