classItemRule
final class ItemRule
Lowers the actions of ALTER TABLE that are not column actions: keys, constraints, renames, conversion and options.
Rule: MYSQL-ALTER-ITEM-001. Scope: alter_list_item (with MYSQL-ALTER-COLUMN-001 for the column actions), opt_to. KEY and INDEX are synonyms; TO, AS, = and no word after RENAME are the same request; CHARACTER SET and CHARSET are synonyms. Keys, constraints and table options are lowered by the table definition family. Constructs: AddConstraint, DropElement, RenameElement, RenameTo, ToggleKeys, IndexVisibility, ConstraintEnforcement, ConvertCharset, SetTableOptions, Force, UpgradePartitioning, and the ALGORITHM and LOCK modifiers of 5.x through MYSQL-ALTER-MODIFIER-001. Terminates: constant work per action. 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 item(Node $item): AlterCommandLowers one action: a node of alter_list_item.
Parameters
$item | Node |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 9
- method-call Lowering::form() line 105
- new ColumnItemRule line 106
- method-call ColumnItemRule::claims() line 107
- method-call ColumnItemRule::item() line 108
- class-const ItemRule::DROPS() line 110
- method-call ItemRule::drop() line 111
- class-const ItemRule::NAMED() line 113
- method-call ItemRule::named() line 114
- method-call ItemRule::simple() line 117
public function simple(Form $form): AlterCommandLowers an action without operands or with one operand another family lowers.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 12
- class-const ItemRule::SIMPLE() line 129
- static-call ImplementationGap::production() line 129
- new AddConstraint line 130
- method-call Form::node() line 130
- new ToggleKeys line 131
- method-call ItemRule::rename() line 133
- new SetTableOptions line 134
- new Force line 135
- new UpgradePartitioning line 136
- method-call ModifierRule::option() line 137
- new ModifierRule line 137
- method-call ItemRule::convert() line 138
public function drop(Form $form): DropElementLowers a DROP of a column, key or constraint.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 6
- class-const ItemRule::DROPS() line 149
- method-call ColumnItemRule::optional() line 154
- new ColumnItemRule line 154
- new DropElement line 158
- method-call ColumnItemRule::name() line 160
- method-call Form::node() line 160
public function named(Form $form, ElementKind $kind): AlterCommandLowers a RENAME of an index or column, or an ALTER of an index or constraint.
Parameters
$form | Form | |
$kind | ElementKind |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 8
- new ColumnItemRule line 172
- method-call Form::token() line 173
- class-const ElementKind::Index() line 174
- method-call Form::node() line 175
- new RenameElement line 178
- method-call ColumnItemRule::name() line 178
- new IndexVisibility line 182
- new ConstraintEnforcement line 185
Lowers RENAME [TO | AS | =] of the table.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 5
- method-call Lowering::form() line 195
- method-call Form::node() line 195
- class-const ItemRule::TO() line 196
- static-call ImplementationGap::production() line 197
- new RenameTo line 200
public function convert(Form $form): ConvertCharsetLowers CONVERT TO CHARACTER SET.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 3
- method-call Form::node() line 210
- new CharsetName line 212
- new ConvertCharset line 214
Private surface 5§
Implementation details, listed for orientation only.
private const DROPS = ['alter_list_item: DROP opt_column field_ident opt_restrict' => [\SqlSemantics\…private const NAMED = ['alter_list_item: RENAME key_or_index field_ident TO_SYM field_ident' => \SqlS…private const SIMPLE = ['alter_list_item: ADD key_def' => 'constraint', 'alter_list_item: ADD table_co…private const TO = ['opt_to:' => true, 'opt_to: TO_SYM' => true, 'opt_to: EQ' => true, 'opt_to: AS…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
ItemRuleTestcalls