classEnclosedQuery
final class EnclosedQuery
Writes the 5.x form of CREATE TABLE ... SELECT whose PARTITION BY clause stands inside the parenthesis that opens the query.
Rule: MYSQL-ENCLOSED-PARTITIONING-001. MySQL 5.6 and 5.7 accept CREATE TABLE t (PARTITION BY … SELECT …) UNION … (create2a: opt_create_partitioning create_select ')' union_opt): the partitioning belongs to the table and the parenthesized SELECT is the first operand of the query, as in CREATE TABLE t PARTITION BY … (SELECT …) UNION …. The query's first operand is reached through the left operands of set operations and leading unions and the body of a query expression without a WITH clause; it must be a parenthesized query. The partitioning is written after its opening parenthesis, everything else as the query writes it (MYSQL-QUERY-TAIL-001). Terminates: the walk follows strict subtrees. Source: sql/sql_yacc.yy of MySQL 5.7 (create2a), https://dev.mysql.com/doc/refman/5.7/en/create-table-select.html. Status: Implemented.
Methods§
public function accepts(Query $query): boolTells whether the first operand of a query is a parenthesized query that the partitioning can be written into.
Parameters
$query | Query |
Returns
boolTest cases 2
public function write(Output $out, Query|LeadingUnion $query, Partitioning $partitioning): voidWrites a query with the partitioning inside the parenthesis of its first operand.
Parameters
$out | Output | |
$query | Query|LeadingUnion | |
$partitioning | Partitioning |
Called from 4
- method-call SqlSemantics\Platform\MySql\Rules\TableDefinition\EnclosedQuery::write() packages/sql-semantics-mysql/src/Rules/TableDefinition/EnclosedQuery.php:64
- method-call SqlSemantics\Platform\MySql\Rules\TableDefinition\EnclosedQuery::write() packages/sql-semantics-mysql/src/Rules/TableDefinition/EnclosedQuery.php:67
- method-call SqlSemantics\Platform\MySql\Rules\TableDefinition\EnclosedQuery::write() packages/sql-semantics-mysql/src/Rules/TableDefinition/EnclosedQuery.php:71
- method-call SqlSemantics\Platform\MySql\Statement\Table\CreateTable::render() packages/sql-semantics-mysql/src/Statement/Table/CreateTable.php:160
Calls 7
- method-call Output::symbol() line 62
- method-call EnclosedQuery::write() line 64
- method-call QueryTails::operation() line 65
- new QueryTails line 65
- method-call QueryTails::leading() line 68
- static-call Check::invariant() line 70
- method-call QueryTails::expression() line 72
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.