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

The one table INSERT, REPLACE, LOAD DATA or a single-table DELETE writes, with its correlation name and partition selection.

Rule: MYSQL-DML-TARGET-001. The name resolves like a table reference (MYSQL-TABLE-SHAPES-001); a common table is no table a statement can write, which the server reports as a non-updatable target. Partition names are not checked: the context holds no partitions. Terminates: no child relation. Source: https://dev.mysql.com/doc/refman/8.4/en/insert.html, https://dev.mysql.com/doc/refman/8.4/en/delete.html, https://dev.mysql.com/doc/refman/8.4/en/partitioning-selection.html. Status: Implemented.

Reading the table a DELETE writesdoctest
$delete = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('DELETE FROM shop.t AS x PARTITION (p0) WHERE x.a = 1');
    [$delete->statement->table->name()->schema?->value, $delete->statement->table->alias()?->value, count($delete->statement->table->partitions)] // => ['shop', 'x', 1]

Properties§

public list<Name> $partitions
public Name|null $alias = null
public AliasMark $mark = AliasMark::As

Methods§

public function __construct(
    public QualifiedName $name,
    public Name|null $alias = null,
    list<Name> $partitions = [],
    public AliasMark $mark = AliasMark::As,
)

Parameters

$nameQualifiedNameThe table name with its optional database
$aliasName|nullThe correlation name; only a single-table DELETE of MySQL 8.0 and later writes one
$partitionslist<Name>The selected partitions
$markAliasMarkWhat is written before the alias
Calls 4
public function name(): QualifiedName

Answers the table name.

Test cases 1
public function alias(): ?Name

Answers the correlation name.

Returns

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

Resolves the name and derives the row shape of the table.

Parameters

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

Writes the name, the correlation name and the partitions.

Parameters

$outOutput
Calls 7

Test cases 11§

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

Dedicated tests 3
Other tests reaching this symbol 8

Relations§

Instantiated in 5
Type declarations 4