classTableQuery
final class TableQuery
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The query of CREATE TABLE ... SELECT, with the handling of rows that duplicate a unique key.
The rows of the query fill the new table. IGNORE discards a row that duplicates a unique key value, REPLACE replaces the old row; without either such a row is an error. The word AS before the query is optional and changes nothing. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table-select.html.
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE TABLE t IGNORE AS SELECT 1 AS a');
$create->statement->query->duplicate // => \SqlSemantics\Platform\MySql\Statement\Dml\DuplicateHandling::IgnoreProperties§
public Query $querypublic DuplicateHandling|null $duplicate = nullMethods§
public function __construct(
public Query $query,
public DuplicateHandling|null $duplicate = null,
)Parameters
$query | Query | The query whose rows fill the table |
$duplicate | DuplicateHandling|null | IGNORE or REPLACE, when written |
public function render(Output $out): voidWrites the duplicate handling and the query.
Parameters
$out | Output |
Calls 1
- method-call Output::keyword() line 44
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TableQueryTestcalls
Other tests reaching this symbol 2
Relations§
Instantiated in 4
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\CreateTableRule::enclosed() packages/sql-semantics-mysql/src/Lowering/TableDefinition/CreateTableRule.php:92
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\CreateTableRule::legacyQuery() packages/sql-semantics-mysql/src/Lowering/TableDefinition/CreateTableRule.php:144
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\CreateTableRule::legacyQuery() packages/sql-semantics-mysql/src/Lowering/TableDefinition/CreateTableRule.php:145
- new SqlSemantics\Platform\MySql\Lowering\TableDefinition\CreateTableRule::query() packages/sql-semantics-mysql/src/Lowering/TableDefinition/CreateTableRule.php:214
Type declarations 4
- type SqlSemantics\Platform\MySql\Lowering\TableDefinition\CreateTableRule packages/sql-semantics-mysql/src/Lowering/TableDefinition/CreateTableRule.php:100
- type SqlSemantics\Platform\MySql\Lowering\TableDefinition\CreateTableRule packages/sql-semantics-mysql/src/Lowering/TableDefinition/CreateTableRule.php:133
- type SqlSemantics\Platform\MySql\Lowering\TableDefinition\CreateTableRule packages/sql-semantics-mysql/src/Lowering/TableDefinition/CreateTableRule.php:200
- type SqlSemantics\Platform\MySql\Statement\Table\CreateTable packages/sql-semantics-mysql/src/Statement/Table/CreateTable.php:86