classTableDefinitionRules
final class TableDefinitionRules
The entry rules of the table definition family: the methods other families and the statement dispatcher call.
Rule: MYSQL-TABLE-DEFINITION-ENTRY-001. Scope: CREATE TABLE with columns, keys, constraints and options, CREATE INDEX, views, and the 5.7 statement PARSE_GCOL_EXPR. The method names, parameters and return types are fixed by the family plan; each method delegates to the rule classes of this family. Source: https://dev.mysql.com/doc/refman/8.4/en/create-table.html. Status: Implemented.
Properties§
public Lowering $loweringMethods§
public function __construct(public Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Lowers a definition statement: a node of create_table_stmt, create_index_stmt, alter_view_stmt,
drop_view_stmt or parse_gcol_expr.
Parameters
$statement | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 11
- method-call CreateTableRule::modern() line 51
- new CreateTableRule line 51
- method-call IndexRule::statement() line 52
- new IndexRule line 52
- method-call ViewRule::alter() line 53
- new ViewRule line 53
- method-call Lowering::form() line 53
- method-call ViewRule::drop() line 54
- method-call ColumnRule::parse() line 55
- new ColumnRule line 55
- static-call ImplementationGap::production() line 56
Lowers a production of create, alter or drop that MYSQL-DEFINITION-ROUTES-001 routes to this
family.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Called from 1
Calls 10
- new ViewRule line 68
- function-call
strstrline 70 - function-call
str_containsline 71 - method-call IndexRule::index() line 71
- new IndexRule line 71
- method-call CreateTableRule::legacy() line 71
- new CreateTableRule line 71
- method-call ViewRule::alter() line 72
- method-call ViewRule::drop() line 73
- static-call ImplementationGap::production() line 74
Lowers CREATE VIEW: a node of view_tail, the node of view_replace_or_algorithm when one is
written, and the definer.
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Calls 2
- method-call ViewRule::create() line 86
- new ViewRule line 86
public function tableElement(Node $element): TableElementLowers one column, index or constraint: a node of column_def, key_def, table_constraint_def,
field_spec or table_element.
Parameters
$element | Node |
Returns
Throws
ImplementationGap When a production has no ruleTest cases 1
Calls 2
- method-call ElementRule::element() line 97
- new ElementRule line 97
public function tableElements(Node $list): list<TableElement>Lowers a parenthesized element list: a node of create_field_list or table_element_list.
Parameters
$list | Node |
Returns
list<TableElement>Throws
ImplementationGap When a production has no ruleTest cases 1
Calls 2
- method-call ElementRule::elements() line 108
- new ElementRule line 108
public function columnSpecification(Node $definition, ?Node $second = null): ColumnSpecificationLowers a column definition without its name: a node of field_def with the node of opt_references
when one follows, or the nodes of type and opt_attribute (5.6).
Returns
Throws
ImplementationGap When a production has no ruleCalls 4
- new ColumnRule line 119
- method-call ColumnRule::specification() line 121
- method-call ReferenceRule::optional() line 124
- new ReferenceRule line 124
public function tableOptions(Node $options): list<TableOption>Lowers table options: a node of create_table_options_space_separated, create_table_options or
opt_create_table_options.
Parameters
$options | Node |
Returns
list<TableOption>Throws
ImplementationGap When a production has no ruleTest cases 1
Calls 2
- method-call TableOptionRule::options() line 136
- new TableOptionRule line 136
public function visible(Node $visibility): boolTells whether an index or column is declared VISIBLE: a node of visibility.
Parameters
$visibility | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleTest cases 1
Calls 2
- method-call KeyOptionRule::visible() line 146
- new KeyOptionRule line 146
public function enforced(Node $enforcement): boolTells whether a check constraint is declared ENFORCED: a node of constraint_enforcement.
Parameters
$enforcement | Node |
Returns
boolThrows
ImplementationGap When the production has no ruleTest cases 1
Calls 2
- method-call KeyRule::enforced() line 156
- new KeyRule line 156
Test cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 9
TableDefinitionRulesTest::testColumnSpecificationLowersAFieldDefWithItsReferencecallsTableDefinitionRulesTest::testCreateViewLowersAViewcallsTableDefinitionRulesTest::testDefinitionLowersALegacyCreateIndexcallsTableDefinitionRulesTest::testEnforcedTellsWhetherEnforcedIsWrittencallsTableDefinitionRulesTest::testStatementLowersCreateTablecallsTableDefinitionRulesTest::testTableElementLowersAColumncallsTableDefinitionRulesTest::testTableElementsLowersTheListcallsTableDefinitionRulesTest::testTableOptionsLowersTheOptionscallsTableDefinitionRulesTest::testVisibleTellsWhetherVisibleIsWrittencalls