classCreateTablespace
final class CreateTablespace
implements Statement
uses Snapshot
@visibility public.CREATE TABLESPACE name [ADD DATAFILE 'file'] [USE LOGFILE GROUP group] [option …]: a request to create a general tablespace.
Mirrors PT_create_tablespace (Sql_cmd_create_tablespace) and the CREATE_TABLESPACE command of st_alter_tablespace in MySQL 5.x. Rule: MYSQL-CREATE-TABLESPACE-001. MySQL 5.x requires the data file; MySQL 8.0 lets InnoDB name it. USE LOGFILE GROUP is for NDB. 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/create-tablespace.html. Status: Implemented.
$statement = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("create tablespace ts add datafile 'ts.ibd' engine = InnoDB");
[$statement->toString(), $statement->statement->datafile?->value] // => ["CREATE TABLESPACE ts ADD DATAFILE 'ts.ibd' ENGINE InnoDB", 'ts.ibd']Properties§
public list<StorageOption> $optionspublic Name $namepublic Text|null $datafile = nullpublic Name|null $logfileGroup = nullMethods§
public function __construct(
public Name $name,
public Text|null $datafile = null,
public Name|null $logfileGroup = null,
list<StorageOption> $options = [],
)Parameters
$name | Name | The tablespace name |
$datafile | Text|null | The data file of ADD DATAFILE, when written |
$logfileGroup | Name|null | The log file group of USE LOGFILE GROUP, when written |
$options | list<StorageOption> | The options in written order |
Calls 3
- method-call StorageOptions::checked() line 48
- new StorageOptions line 48
- class-const StorageOptions::TABLESPACE() line 48
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 56
- new StorageOptions line 56
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 64
- class-const NameUse::Identifier() line 64
- method-call StorageOptions::render() line 71
- new StorageOptions line 71
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CreateTablespaceTestcalls
Other tests reaching this symbol 2
Relations§
Instantiated in 2
- new SqlSemantics\Platform\MySql\Lowering\Server\Storage\TablespaceRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Storage/TablespaceRule.php:101
- new SqlSemantics\Platform\MySql\Lowering\Server\Storage\TablespaceRule::statement() packages/sql-semantics-mysql/src/Lowering/Server/Storage/TablespaceRule.php:107