classColumnItemRule
final class ColumnItemRule
Lowers the column actions of ALTER TABLE.
Rule: MYSQL-ALTER-COLUMN-001. Scope: the alter_list_item productions that add, change, modify or alter columns, add_column, opt_column, opt_place, alter_order_clause, alter_order_list, alter_order_item. Column definitions are lowered by the table definition family (TableDefinitionRules::tableElement, columnSpecification, tableElements); an 8.0 column name is an unqualified ColumnName, a 5.x field_ident may be qualified. COLUMN is an optional word. Constructs: AddColumn, AddColumns, ChangeColumn (CHANGE and MODIFY), DefaultSetting, ColumnVisibility, ColumnPosition, Reorder. Terminates: lists are flattened iteratively. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function claims(string $signature): boolTells whether a production of alter_list_item is a column action.
Parameters
$signature | string |
Returns
boolCalled from 1
Calls 3
- class-const ColumnItemRule::DEFINED() line 94
- class-const ColumnItemRule::ALTERED() line 94
- class-const ColumnItemRule::LISTED() line 94
public function item(Form $form): AlterCommandLowers a column action of alter_list_item.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 15
- method-call ColumnItemRule::column() line 104
- class-const ColumnItemRule::LISTED() line 105
- new AddColumns line 108
- method-call Form::node() line 108
- new Reorder line 108
- method-call ColumnItemRule::order() line 108
- class-const ColumnItemRule::ALTERED() line 110
- method-call ColumnItemRule::altered() line 111
- class-const ColumnItemRule::DEFINED() line 113
- static-call ImplementationGap::production() line 113
- method-call ColumnItemRule::position() line 114
- new AddColumn line 117
- method-call ColumnItemRule::definition() line 117
- new ChangeColumn line 118
- method-call ColumnItemRule::name() line 118
public function altered(Form $form): AlterCommandLowers an ALTER COLUMN action: a default or a visibility.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 6
- class-const ColumnItemRule::ALTERED() line 130
- static-call ImplementationGap::production() line 130
- method-call ColumnItemRule::name() line 131
- method-call Form::node() line 131
- new DefaultSetting line 133
- new ColumnVisibility line 139
public function column(Form $form): voidConfirms the optional COLUMN keyword of an action, or of its add_column prefix.
Parameters
$form | Form |
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 3
- method-call Lowering::form() line 152
- static-call ImplementationGap::production() line 154
- method-call ColumnItemRule::optional() line 156
public function optional(Node $column): voidConfirms a node of opt_column, whose keyword has no effect.
Parameters
$column | Node |
Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::column() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:156
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::column() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:162
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::drop() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:154
Calls 2
- method-call Lowering::form() line 173
- static-call ImplementationGap::production() line 175
public function definition(
Form $form,
int|null $name,
int $operand,
int|null $second,
): ColumnDefinitionLowers a column definition: from a column_def or field_spec node, or from a name and its specification.
Parameters
$form | Form | |
$name | int|null | The position of the name, or null when the operand holds it |
$operand | int | The position of the definition or of the type |
$second | int|null | The position of the second part of the specification, when there is one |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 3
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:117
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:118
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:119
Calls 4
- method-call Form::node() line 191
- static-call Check::invariant() line 192
- new ColumnDefinition line 197
- method-call ColumnItemRule::name() line 197
public function name(Node $name): ColumnNameLowers the name of an altered column: a node of field_ident (5.x) or ident.
Parameters
$name | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 5
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:118
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::altered() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:131
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::definition() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:197
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::drop() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:160
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::named() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:178
Calls 1
- new ColumnName line 211
public function position(Form $form, int $place): ?ColumnPositionLowers the position of an added or changed column: a node of opt_place; no position is null.
Parameters
$form | Form | |
$place | int |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- method-call Lowering::form() line 221
- method-call Form::node() line 221
- new ColumnPosition line 225
- static-call ImplementationGap::production() line 227
Lowers the ordering columns: a node of alter_order_clause or alter_order_list.
Parameters
$list | Node |
Returns
list<OrderItem>Throws
ImplementationGap When a production has no ruleCalled from 2
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:108
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::order() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:241
Calls 7
- method-call Lowering::form() line 239
- method-call ColumnItemRule::order() line 241
- static-call ImplementationGap::production() line 244
- method-call Lists::items() line 247
- new Lists line 247
- class-const ColumnItemRule::ORDER_ITEMS() line 249
- new OrderItem line 250
Private surface 5§
Implementation details, listed for orientation only.
private const DEFINED = ['alter_list_item: add_column column_def opt_place' => ['add', null, 1, null, 2…private const ALTERED = ['alter_list_item: ALTER opt_column field_ident SET DEFAULT signed_literal' => …private const LISTED = ['alter_list_item: add_column ( create_field_list )' => ['adds', 2], 'alter_lis…private const ORDER_ITEMS = ['alter_order_item: simple_ident_nospvar order_dir' => 1, 'alter_order_item: si…private Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ColumnItemRuleTestcalls
Relations§
Instantiated in 4
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:106
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::drop() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:154
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::drop() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:156
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::named() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:172
Method calls 5
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:107
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::item() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:108
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::drop() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:154
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::drop() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:160
- method-call SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ItemRule::named() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ItemRule.php:178