classAddPartition
final class AddPartition
implements StandaloneCommand
uses Snapshot
Public API: explicitly declared with
@visibility public.ADD PARTITION [NO_WRITE_TO_BINLOG] [(definitions) | PARTITIONS n]: a request to add partitions.
Mirrors PT_alter_table_add_partition, PT_alter_table_add_partition_def_list and PT_alter_table_add_partition_num: definitions for RANGE and LIST tables, a count for HASH and KEY tables, or neither. LOCAL and NO_WRITE_TO_BINLOG are synonyms. The partition values are constants. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table-partition-operations.html.
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t ADD PARTITION PARTITIONS 2');
$alter->statement->commands[0]->count?->text // => '2'Properties§
public list<PartitionDefinition> $definitionspublic bool $localpublic Numeral|null $count = nullMethods§
public function __construct(
public bool $local,
list<PartitionDefinition> $definitions,
public Numeral|null $count = null,
)Parameters
$local | bool | Whether NO_WRITE_TO_BINLOG or LOCAL is written |
$definitions | list<PartitionDefinition> | The new partitions in order |
$count | Numeral|null | The PARTITIONS count, when written |
Calls 3
- static-call Check::listOf() line 45
- class-const PartitionDefinition::class() line 45
- static-call Check::input() line 46
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives the partition values as constants.
Parameters
$derivation | Derivation | |
$scope | Environment |
public function render(Output $out): voidWrites the action.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 64
- method-call Output::symbol() line 69
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
AddPartitionTestcalls
Relations§
Instantiated in 6
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\StandaloneRule::command() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/StandaloneRule.php:155
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\StandaloneRule::pair() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/StandaloneRule.php:173
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\StandaloneRule::pair() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/StandaloneRule.php:174
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\StandaloneRule::addRule() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/StandaloneRule.php:229
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\StandaloneRule::addRule() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/StandaloneRule.php:230
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\StandaloneRule::addRule() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/StandaloneRule.php:231