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

An INSERT of rows written in a VALUES clause.

Rule: SQLITE-INSERT-ROWS-001. The facts follow SQLITE-INSERT-001 with the VALUES clause as the source of the rows. Source: https://sqlite.org/lang_insert.html. Status: Implemented.

Reading the rows of an INSERTdoctest
$insert = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze("INSERT INTO t (a, b) VALUES (1, 'x'), (2, 'y') RETURNING a");
    [count($insert->statement->rows->rows), count($insert->statement->returning), $insert->toString()] // => [2, 1, "INSERT INTO t (a, b) VALUES (1, 'x'), (2, 'y') RETURNING a"]

Properties§

public list<Upsert> $upserts
public list<ResultColumn|Star|TableStar> $returning
public InsertInto $into

Methods§

public function __construct(
    public InsertInto $into,
    public ValuesClause $rows,
    list<Upsert> $upserts = [],
    list<ResultColumn|Star|TableStar> $returning = [],
)

Parameters

$intoInsertIntoThe head: verb, written table and column list
$rowsValuesClauseThe rows
$upsertslist<Upsert>The ON CONFLICT clauses; only the last may omit its conflict target
$returninglist<ResultColumn|Star|TableStar>The RETURNING columns

Throws

InvalidConstruction When a RETURNING column is of no result column class
Calls 9
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 2
public function render(Output $out): void

Writes the statement.

Parameters

$outOutput
Calls 2

Test cases 29§

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 25

Relations§

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