final class AlterTablespaceDatafile
    implements Statement
    uses Snapshot
Public API: explicitly declared with @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.

Adding a data filedoctest
$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> $options
public Name $name
public DatafileAction $action
public Text $datafile

Methods§

public function __construct(
    public Name $name,
    public DatafileAction $action,
    public Text $datafile,
    list<StorageOption> $options = [],
)

Parameters

$nameNameThe tablespace name
$actionDatafileActionADD, DROP or CHANGE
$datafileTextThe data file
$optionslist<StorageOption>The options in written order
Calls 5
public function deriveStatement(Derivation $derivation): void

Reports the options the server rejects while it parses the statement.

Parameters

$derivationDerivation
Calls 2
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 4

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 1