final class UpsertMutationRow

Names the columns an UPSERT carries its assignment values under.

The rewritten statement works out, per row, whether the conflict clause applied and what each assignment came to, and reads both back alongside the row. Those columns are carried under names no table would use, and taken off again before the row is handed to the caller.

Type Aliases§

Row = import from TableDefinition

Methods§

public function valueColumn(int $index): string

Answers the name one assignment's value is carried under.

Parameters

$indexintPosition of the assignment in the conflict clause

Returns

string Name no table would use
Test cases 10
Called from 5
Calls 1
public function predicateMatches(mixed $value): bool

Reports whether the verdict a driver read back means the clause applied.

Every driver spells truth differently — a boolean, a one, the text of a one, or Postgres\'s single t — and all four mean the same thing here.

Parameters

$valuemixedVerdict as the driver read it back

Returns

bool True when the conflict clause applied
Test cases 1
Called from 1
public function incomingRow(Row $row, int $valueCount): Row

Takes the carried columns off a row, leaving the row the statement wrote.

Parameters

$rowRowRow as the rewritten statement read it back
$valueCountintHow many assignments the conflict clause declares

Returns

Row The row as the caller should see it
Test cases 3
Called from 1
Calls 2

Private surface 2§

Implementation details, listed for orientation only.

private const VALUE_PREFIX = '__ztd_upsert_value_'
private const PREDICATE = '__ztd_upsert_predicate'

Test cases 14§

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

Dedicated tests 5
Other tests reaching this symbol 9

Relations§

Instantiated in 4
Method calls 11
Type declarations 1