final class InsertProjectionBuilder
Restricted visibility: declared "@visibility ZtdQuery\Platform\Sqlite". Code outside that scope must not name this declaration.

Builds INSERT SELECT and VALUES projections in table column order.

Methods§

public function __construct(
    private CastRenderer $castRenderer,
    private ShadowIdentityAllocator $identityAllocator,
    private InsertSelectRenderer $insertSelectRenderer,
    private SqliteParser $parser,
    private InsertRowRenderer $rowRenderer,
)

Binds the collaborators used by this operation.

Parameters

$castRendererCastRenderer
$identityAllocatorShadowIdentityAllocator
$insertSelectRendererInsertSelectRenderer
$parserSqliteParser
$rowRendererInsertRowRenderer
public function buildInsertSelect<TValue>(
    string $sql,
    string $tableName,
    list<string> $tableColumns,
    list<string> $insertColumns,
    array<string, ColumnDeclaration> $columnTypes,
    array<string, string> $columnDefaults,
    array<string, IdentityGenerationStrategy> $identityStrategies,
    array<int, array<string, TValue>> $existingRows,
): string

Parameters

$sqlstring
$tableNamestring
$tableColumnslist<string>
$insertColumnslist<string>
$columnTypesarray<string, ColumnDeclaration>
$columnDefaultsarray<string, string>
$identityStrategiesarray<string, IdentityGenerationStrategy>
$existingRowsarray<int, array<string, TValue>>

Returns

string

Throws

RuntimeException
Test cases 2
Called from 1
Calls 9
public function buildInsertRowSelect<TValue>(
    array<int, string> $values,
    string $tableName,
    list<string> $tableColumns,
    list<string> $insertColumns,
    array<string, ColumnDeclaration> $columnTypes,
    array<string, string> $columnDefaults,
    array<string, IdentityGenerationStrategy> $identityStrategies,
    array<int, array<string, TValue>> $existingRows,
): string

Parameters

$valuesarray<int, string>
$tableNamestring
$tableColumnslist<string>
$insertColumnslist<string>
$columnTypesarray<string, ColumnDeclaration>
$columnDefaultsarray<string, string>
$identityStrategiesarray<string, IdentityGenerationStrategy>
$existingRowsarray<int, array<string, TValue>>

Returns

string

Throws

RuntimeException
Test cases 1
Called from 1
Calls 9
public function buildSelectSource<TValue>(
    string $sql,
    string $tableName,
    list<string> $tableColumns,
    list<string> $insertColumns,
    array<string, string> $columnDefaults,
    array<string, IdentityGenerationStrategy> $identityStrategies,
    array<int, array<string, TValue>> $existingRows,
): string

Projects an INSERT SELECT source and allocates any omitted identities.

Parameters

$sqlstring
$tableNamestring
$tableColumnslist<string>
$insertColumnslist<string>
$columnDefaultsarray<string, string>
$identityStrategiesarray<string, IdentityGenerationStrategy>
$existingRowsarray<int, array<string, TValue>>

Returns

string

Throws

RuntimeException
Test cases 1
Called from 1
Calls 4

Private surface 5§

Implementation details, listed for orientation only.

private CastRenderer $castRenderer
private ShadowIdentityAllocator $identityAllocator
private InsertSelectRenderer $insertSelectRenderer
private SqliteParser $parser
private InsertRowRenderer $rowRenderer

Test cases 10§

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 5

Relations§

Instantiated in 1
Static calls 2
Method calls 1