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

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

$loweringLoweringThe lowering this rule belongs to
public function claims(string $signature): bool

Tells whether a production of alter_list_item is a column action.

Parameters

$signaturestring

Returns

bool
Called from 1
Calls 3
public function column(Form $form): void

Confirms the optional COLUMN keyword of an action, or of its add_column prefix.

Parameters

$formForm

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 3
public function definition(
    Form $form,
    int|null $name,
    int $operand,
    int|null $second,
): ColumnDefinition

Lowers a column definition: from a column_def or field_spec node, or from a name and its specification.

Parameters

$formForm
$nameint|nullThe position of the name, or null when the operand holds it
$operandintThe position of the definition or of the type
$secondint|nullThe position of the second part of the specification, when there is one

Throws

ImplementationGap When a production has no rule
Called from 3
Calls 4
public function position(Form $form, int $place): ?ColumnPosition

Lowers the position of an added or changed column: a node of opt_place; no position is null.

Parameters

$formForm
$placeint

Throws

ImplementationGap When a production has no rule
Called from 1
Calls 4

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 $lowering

Test cases 1§

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

Dedicated tests 1

Relations§

Instantiated in 4
Method calls 5