final class UpdateTransformer
    implements SqlTransformer

Transforms UPDATE statements into SELECT projections with CTE shadowing.

PostgreSQL differences:

  • FROM clause for multi-table updates (not comma-separated table list)
  • Double-quote identifiers

Methods§

public function __construct(PgSqlParser $parser, SelectTransformer $selectTransformer)

Initializes the collaborators and state used by this update transformer.

Parameters

$parserPgSqlParser
$selectTransformerSelectTransformer
Calls 1
public function buildProjection(
    string $sql,
    string $targetTable,
    array<int, string> $columns,
    array<int, string> $primaryKeys = [],
): array{sql: string, table: string, tables: array<string, array{alias: string}>}

Build a result-select SQL from an UPDATE statement.

Parameters

$sqlstring
$targetTablestring
$columnsarray<int, string>
$primaryKeysarray<int, string>

Returns

array{sql: string, table: string, tables: array<string, array{alias: string}>}
Test cases 15
Called from 1
Calls 6

Private surface 3§

Implementation details, listed for orientation only.

private PgSqlParser $parser
private SelectTransformer $selectTransformer
private PgSqlCteShadowComposer $cteComposer

Test cases 163§

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

Dedicated tests 19
Other tests reaching this symbol 144

Relations§

Instantiated in 1
Method calls 1
Type declarations 2