classAlterTablespaceDatafile
final class AlterTablespaceDatafile
implements Statement
uses Snapshot
@visibility public.ALTER TABLESPACE name {ADD | DROP | CHANGE} DATAFILE 'file' [option …]: a request to add, remove or resize a data file of a tablespace.
Mirrors PT_alter_tablespace_add_datafile, PT_alter_tablespace_drop_datafile and the ALTER_TABLESPACE commands of st_alter_tablespace in MySQL 5.x. Rule: MYSQL-ALTER-TABLESPACE-DATAFILE-001. ADD and DROP are NDB requests; CHANGE (MySQL 5.x) takes size options only and at least one. The options are checked, kept and written in order by MYSQL-STORAGE-OPTIONS-001. A tablespace is no relation, so the statement neither declares nor resolves one. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-tablespace.html. Status: Implemented.
$statement = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("alter tablespace ts add datafile 'b.dat' initial_size = 16M");
[$statement->toString(), $statement->statement->action] // => ["ALTER TABLESPACE ts ADD DATAFILE 'b.dat' INITIAL_SIZE `16M`", \SqlSemantics\Platform\MySql\Statement\Server\Storage\Option\DatafileAction::Add]Properties§
public list<StorageOption> $optionspublic Name $namepublic DatafileAction $actionpublic Text $datafileMethods§
public function __construct(
public Name $name,
public DatafileAction $action,
public Text $datafile,
list<StorageOption> $options = [],
)Parameters
$name | Name | The tablespace name |
$action | DatafileAction | ADD, DROP or CHANGE |
$datafile | Text | The data file |
$options | list<StorageOption> | The options in written order |
Calls 5
- method-call StorageOptions::checked() line 49
- new StorageOptions line 49
- class-const DatafileAction::Change() line 49
- class-const StorageOptions::CHANGE_DATAFILE() line 49
- class-const StorageOptions::ALTER_TABLESPACE() line 49
public function deriveStatement(Derivation $derivation): voidReports the options the server rejects while it parses the statement.
Parameters
$derivation | Derivation |
Calls 2
- method-call StorageOptions::derive() line 57
- new StorageOptions line 57
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 65
- class-const NameUse::Identifier() line 65
- method-call StorageOptions::render() line 66
- new StorageOptions line 66
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.