classExecute
final class Execute
implements Statement
uses Snapshot
@visibility public.EXECUTE: a run of a prepared statement with values for its parameters.
Mirrors PostgreSQL's ExecuteStmt (name, params). Rule: PG-EXECUTE-001. The values are derived in the empty environment. The prepared statement is session state, so the rows returned are an open shape that depends on it. Source: https://www.postgresql.org/docs/17/sql-execute.html. Status: Implemented.
$execute = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("EXECUTE p (1, 'x')");
[count($execute->statement->parameters), $execute->shape()->complete()] // => [2, false]Properties§
public list<Scalar> $parameterspublic Name $nameMethods§
public function __construct(public Name $name, list<Scalar> $parameters = [])Parameters
$name | Name | The name of the prepared statement |
$parameters | list<Scalar> | The parameter values in order |
Throws
InvalidConstruction When a value is not an expressionCalls 2
- static-call Check::listOf() line 52
- class-const Scalar::class() line 52
public function deriveStatement(Derivation $derivation): voidDerives the values and records the open rows of the prepared statement.
Parameters
$derivation | Derivation |
Calls 3
- method-call Execute::deriveParameters() line 60
- method-call Derivation::output() line 61
- method-call Execute::rows() line 61
public function deriveParameters(Derivation $derivation): voidDerives the values, for a statement that runs the prepared statement for another purpose, such as CREATE TABLE AS EXECUTE.
Parameters
$derivation | Derivation |
Called from 1
Calls 5
- method-call Derivation::environment() line 69
- method-call Derivation::scalar() line 71
- new Placement line 73
- method-call Placement::values() line 74
- method-call Placement::into() line 75
public function rows(Derivation $derivation): QueryFactAnswers the rows of the prepared statement: an open shape that depends on the session.
Parameters
$derivation | Derivation |
Returns
Called from 1
public function render(Output $out): voidWrites the statement.
Parameters
$out | Output |
Calls 3
- method-call Output::keyword() line 91
- class-const NameUse::Column() line 91
- method-call Output::symbol() line 93
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ExecuteTestcalls
Other tests reaching this symbol 3
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\PreparedRule::execute() packages/sql-semantics-postgres/src/Lowering/Manipulation/PreparedRule.php:76
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\PreparedRule::execute() packages/sql-semantics-postgres/src/Lowering/Manipulation/PreparedRule.php:79
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\PreparedRule::execute() packages/sql-semantics-postgres/src/Lowering/Manipulation/PreparedRule.php:83