final class CreateTableRule
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Lowers CREATE TABLE in its column list, query and LIKE forms.

Rule: MYSQL-CREATE-TABLE-LOWERING-001. Scope: the create alternative CREATE opt_table_options TABLE_SYM …, create2, create2a, create3, opt_table_options, table_options, table_option (5.x); create_table_stmt, opt_create_table_options_etc, opt_create_partitioning_etc, opt_duplicate_as_qe, as_create_query_expression (8.0 and later). The word AS before the query and the parentheses around LIKE t change nothing. The partitioning clause comes from the table change family, the query from the query family and IGNORE or REPLACE from the data manipulation family. Constructs: CreateTable, CreateTableLike, TableQuery. Terminates: every child is a strict subtree. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html, https://dev.mysql.com/doc/refman/5.7/en/create-table.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe lowering this rule belongs to
public function enclosed(
    QualifiedName $name,
    Form $form,
    int $temporary,
    bool $exists,
): CreateTable
public function partitioned(
    QualifiedName $name,
    ?Partitioning $partitioning,
    TableQuery $query,
    int $temporary,
    bool $exists,
): CreateTable

Builds CREATE TABLE ... SELECT whose query is written in parentheses, with the partitioning inside them when one is written.

Parameters

$nameQualifiedName
$partitioning?Partitioning
$queryTableQuery
$temporaryint
$existsbool
Called from 1
Calls 1
public function temporary(Node $options): int

Counts the TEMPORARY words of 5.x: a node of opt_table_options.

Parameters

$optionsNode

Returns

int

Throws

ImplementationGap When a production has no rule
Test cases 1
Called from 1
Calls 3
public function modern(Node $statement): Statement
public function rest(
    QualifiedName $name,
    list<TableElement> $elements,
    Node $rest,
    int $temporary,
    bool $exists,
): CreateTable
public function query(Node $part): ?TableQuery

Lowers the 8.0 query part: a node of opt_duplicate_as_qe; none is null.

Parameters

$partNode

Returns

Throws

ImplementationGap When a production has no rule
Test cases 1
Called from 1
Calls 2

Private surface 1§

Implementation details, listed for orientation only.

private Lowering $lowering

Test cases 8§

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

Dedicated tests 8

Relations§

Instantiated in 2
Method calls 2