final class InsertInto
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The head of INSERT and REPLACE: the verb, its modifiers, the table and the optional column list.

Mirrors the server's PT_insert with its is_replace flag: REPLACE deletes a row that duplicates a unique key before it inserts the new one. REPLACE takes no IGNORE and no HIGH_PRIORITY; the written table has no correlation name. The keyword INTO is optional and always written. Source: https://dev.mysql.com/doc/refman/8.4/en/insert.html, https://dev.mysql.com/doc/refman/8.4/en/replace.html.

Reading the head of a REPLACEdoctest
$replace = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('REPLACE LOW_PRIORITY t VALUES (1)');
    [$replace->statement->into->replace, $replace->statement->into->priority, $replace->toString()] // => [true, \SqlSemantics\Platform\MySql\Statement\Dml\Insert\InsertPriority::Low, 'REPLACE LOW_PRIORITY INTO t VALUES (1)']

Properties§

public bool $replace
public InsertPriority|null $priority
public bool $ignore
public WriteTarget $table
public ColumnList|null $columns = null

Methods§

public function __construct(
    public bool $replace,
    public InsertPriority|null $priority,
    public bool $ignore,
    public WriteTarget $table,
    public ColumnList|null $columns = null,
)

Parameters

$replaceboolWhether the verb is REPLACE
$priorityInsertPriority|nullThe scheduling modifier
$ignoreboolWhether IGNORE turns errors into warnings
$tableWriteTargetThe table the rows are written to
$columnsColumnList|nullThe columns written; null for every column of the table

Throws

InvalidConstruction When REPLACE has IGNORE or HIGH_PRIORITY, or the table has a correlation name
Calls 2
public function render(Output $out): void

Writes the verb, the modifiers, INTO, the table and the column list.

Parameters

$outOutput
Calls 1

Test cases 4§

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

Dedicated tests 2
Other tests reaching this symbol 2

Relations§

Instantiated in 4
Type declarations 6