classCreateTableAsSelectMutation
final class CreateTableAsSelectMutation
implements ResultSetMutation
Applies CREATE TABLE ... AS SELECT ... operation to the virtual schema. This mutation creates a new table with structure and data from SELECT.
Methods§
public function __construct(
string $tableName,
list<string> $columnNames,
TableDefinitionRegistry $registry,
ColumnDeclaration $fallbackColumnType,
bool $ifNotExists = false,
)Parameters
$tableName | string | The name of the new table to create. |
$columnNames | list<string> | Column names extracted from SELECT. |
$registry | TableDefinitionRegistry | The registry. |
$fallbackColumnType | ColumnDeclaration | The dialect-provided type used when result metadata is unavailable. |
$ifNotExists | bool | Whether to skip if table exists. |
Test cases 10
CreateTableAsSelectMutationTest::testApplyInfersColumnsFromResultRowsForSelectStarcoversCreateTableAsSelectMutationTest::testApplyKeepsParsedProjectionNamesWhenMetadataIsUnavailablecoversCreateTableAsSelectMutationTest::testApplyRegistersTableWithColumnsFromSelectcoversCreateTableAsSelectMutationTest::testApplyResultSetCreatesEmptyTableFromMetadatacoversCreateTableAsSelectMutationTest::testApplyResultSetKeepsExplicitColumnNamesWithMetadataTypescoversCreateTableAsSelectMutationTest::testApplyResultSetUsesMetadataTypesInsteadOfTextFallbackcoversCreateTableAsSelectMutationTest::testApplyStoresRowsFromSelectResultcoversCreateTableAsSelectMutationTest::testApplyThrowsExceptionWhenTableExistscoversCreateTableAsSelectMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscoversCreateTableAsSelectMutationTest::testTableNameReturnsNewTableNamecovers
public function apply(ShadowStore $store, array $rows): void{@inheritDoc}
Parameters
$store | ShadowStore | |
$rows | array |
Test cases 6
CreateTableAsSelectMutationTest::testApplyInfersColumnsFromResultRowsForSelectStarcovers and callsCreateTableAsSelectMutationTest::testApplyKeepsParsedProjectionNamesWhenMetadataIsUnavailablecovers and callsCreateTableAsSelectMutationTest::testApplyRegistersTableWithColumnsFromSelectcovers and callsCreateTableAsSelectMutationTest::testApplyStoresRowsFromSelectResultcovers and callsCreateTableAsSelectMutationTest::testApplyThrowsExceptionWhenTableExistscovers and callsCreateTableAsSelectMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscovers and calls
Calls 2
- method-call CreateTableAsSelectMutation::applyResultSet() line 57
- new ResultSet line 57
public function applyResultSet(ShadowStore $store, ResultSet $result): voidParameters
$store | ShadowStore | |
$result | ResultSet |
Throws
RuntimeException When the result set does not describe a table that could be createdTest cases 11
ResultSetMutationTest::testApplyResultSetGivesTheNewTableTheColumnsTheResultDescribedcallsResultSetMutationTest::testApplyResultSetGivesTheNewTableTheRowsTheResultCarriedcallsCreateTableAsSelectMutationTest::testApplyInfersColumnsFromResultRowsForSelectStarcoversCreateTableAsSelectMutationTest::testApplyKeepsParsedProjectionNamesWhenMetadataIsUnavailablecoversCreateTableAsSelectMutationTest::testApplyRegistersTableWithColumnsFromSelectcoversCreateTableAsSelectMutationTest::testApplyResultSetCreatesEmptyTableFromMetadatacovers and callsCreateTableAsSelectMutationTest::testApplyResultSetKeepsExplicitColumnNamesWithMetadataTypescovers and callsCreateTableAsSelectMutationTest::testApplyResultSetUsesMetadataTypesInsteadOfTextFallbackcovers and callsCreateTableAsSelectMutationTest::testApplyStoresRowsFromSelectResultcoversCreateTableAsSelectMutationTest::testApplyThrowsExceptionWhenTableExistscoversCreateTableAsSelectMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscovers
Called from 1
Calls 7
- method-call TableDefinitionRegistry::has() line 65
- new
RuntimeExceptionline 69 - function-call
array_mapline 75 - function-call
array_keysline 78 - new TableDefinition line 93
- method-call TableDefinitionRegistry::register() line 102
- method-call ShadowStore::set() line 103
public function tableName(): string{@inheritDoc}
Returns
stringTest cases 1
CreateTableAsSelectMutationTest::testTableNameReturnsNewTableNamecovers and calls
Private surface 5§
Implementation details, listed for orientation only.
private string $tableNameprivate list<string> $columnNamesprivate TableDefinitionRegistry $registryprivate ColumnDeclaration $fallbackColumnTypeprivate bool $ifNotExistsTest cases 12§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 10
CreateTableAsSelectMutationTest::testApplyInfersColumnsFromResultRowsForSelectStarcovers and callsCreateTableAsSelectMutationTest::testApplyKeepsParsedProjectionNamesWhenMetadataIsUnavailablecovers and callsCreateTableAsSelectMutationTest::testApplyRegistersTableWithColumnsFromSelectcovers and callsCreateTableAsSelectMutationTest::testApplyResultSetCreatesEmptyTableFromMetadatacovers and callsCreateTableAsSelectMutationTest::testApplyResultSetKeepsExplicitColumnNamesWithMetadataTypescovers and callsCreateTableAsSelectMutationTest::testApplyResultSetUsesMetadataTypesInsteadOfTextFallbackcovers and callsCreateTableAsSelectMutationTest::testApplyStoresRowsFromSelectResultcovers and callsCreateTableAsSelectMutationTest::testApplyThrowsExceptionWhenTableExistscovers and callsCreateTableAsSelectMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscovers and callsCreateTableAsSelectMutationTest::testTableNameReturnsNewTableNamecovers and calls
Other tests reaching this symbol 2
Relations§
Constant reads 1
- class-const packages/ztd-query-core/src/Compatibility/ClassAliases.php packages/ztd-query-core/src/Compatibility/ClassAliases.php:27