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

A DELETE of the rows of a table that satisfy a predicate.

Rule: SQLITE-DELETE-001. The predicate sees the written table and, beyond it, the enclosing environment; the rest follows SQLITE-MUTATION-SCOPE-001. Source: https://sqlite.org/lang_delete.html. Status: Implemented.

Reading the parts of a DELETEdoctest
$delete = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('DELETE FROM t WHERE a = 1 RETURNING a');
    [$delete->statement->target->name->name->value, $delete->statement->where !== null, $delete->field(0)->name->value] // => ['t', true, 'a']

Properties§

public list<ResultColumn|Star|TableStar> $returning
public MutationTarget $target
public Scalar|null $where = null
public WithClause|null $with = null

Methods§

public function __construct(
    public MutationTarget $target,
    public Scalar|null $where = null,
    list<ResultColumn|Star|TableStar> $returning = [],
    public WithClause|null $with = null,
)

Parameters

$targetMutationTargetThe written table
$whereScalar|nullThe row predicate
$returninglist<ResultColumn|Star|TableStar>The RETURNING columns
$withWithClause|nullThe WITH clause of the statement

Throws

InvalidConstruction When a RETURNING column is of no result column class
Calls 5
public function deriveStatement(Derivation $derivation): void

Derives the statement as a root and records the rows of RETURNING as the output.

Parameters

$derivationDerivation
Calls 5
public function deriveWithin(Derivation $derivation, Environment $outer): ?QueryFact

Derives the statement inside an environment, as a trigger program does, and answers the rows it returns.

Parameters

$derivationDerivation
$outerEnvironment

Returns

Called from 1
Calls 5
public function render(Output $out): void

Writes the statement.

Parameters

$outOutput
Calls 2

Test cases 21§

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

Dedicated tests 4
Other tests reaching this symbol 17

Relations§

Instantiated in 2
Constant reads 1
Type checks 3
Type declarations 2