final class RowAlias
    implements Relation
    uses Snapshot
Public API: explicitly declared with @visibility public.

The alias AS name [(column, ...)] of the new row of INSERT, which ON DUPLICATE KEY UPDATE refers to (MySQL 8.0.19 and later).

Rule: MYSQL-DML-ROW-ALIAS-001. The alias is a relation with one column per written column, in order, holding the value that row would insert; its columns take the names of the alias column list, or the names of the written columns. The statement derives the alias at a position whose environment holds the written columns as its fields, or, when the written table is not declared completely, that table as its relation: the columns then depend on the missing declaration. A column list of another length, or a repeated column name, is reported as the server does for derived column names. Terminates: no child. Source: https://dev.mysql.com/doc/refman/8.4/en/insert-on-duplicate.html. Status: Implemented.

Reading the alias of the new rowdoctest
$insert = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('INSERT INTO t (a, b) VALUES (1, 2) AS new (m, n) ON DUPLICATE KEY UPDATE a = m + n');
    [$insert->statement->alias->name->value, count($insert->statement->alias->columns)] // => ['new', 2]

Properties§

public list<Name> $columns
public Name $name

Methods§

public function __construct(public Name $name, list<Name> $columns = [])

Parameters

$nameNameThe alias
$columnslist<Name>The column names
Calls 2
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Derives one column per written column, named by the column list when it is written.

Parameters

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

Writes the alias and its column list.

Parameters

$outOutput
Calls 4

Test cases 2§

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 1

Relations§

Instantiated in 1
Type declarations 5