final class MutationTarget
    implements NamedRelation
    uses Snapshot
Public API: explicitly declared with @visibility public.

The table a data change statement writes to, with its optional correlation name and index choice.

Rule: SQLITE-MUTATION-TARGET-001. The name denotes a declared relation found along the schema search path; a common table of that name is never the target. The shape follows SQLITE-TABLE-SHAPE-001. Source: https://sqlite.org/lang_insert.html, https://sqlite.org/lang_update.html, https://sqlite.org/lang_delete.html. Status: Implemented.

Reading the table a statement writes todoctest
$semantics = new \SqlSemantics\Platform\Sqlite\Semantics();
    $table = $semantics->analyze('CREATE TABLE t (a INTEGER)');
    $delete = $semantics->analyze('DELETE FROM t AS x WHERE x.a = 1', [$table]);
    [$delete->statement->target->alias()->value, $delete->facts->relation($delete->statement->target)->table->table === $table->declarations()[0]] // => ['x', true]

Properties§

public Name|null $alias = null
public IndexChoice|null $index = null

Methods§

public function __construct(
    public QualifiedName $name,
    public Name|null $alias = null,
    public IndexChoice|null $index = null,
)

Parameters

$nameQualifiedNameThe table name
$aliasName|nullThe correlation name
$indexIndexChoice|nullThe demanded index
public function name(): QualifiedName

Answers the table name.

public function alias(): ?Name

Answers the correlation name.

Returns

public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Resolves the name among the declared relations and derives the row shape of the table.

Parameters

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

Writes the name, the correlation name and the index choice.

Parameters

$outOutput
Calls 6

Test cases 20§

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

Dedicated tests 1
Other tests reaching this symbol 19

Relations§

Instantiated in 8
Type declarations 8