classAlterDatabase
final class AlterDatabase
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.ALTER {DATABASE | SCHEMA} [name] option …: a request to change the options of a database.
Mirrors SQLCOM_ALTER_DB. Rule: MYSQL-ALTER-DATABASE-001. Without a name the current database is altered. The options are kept in written order. The statement changes no declaration. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-database.html. Status: Implemented.
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('alter schema character set latin1 read only default');
[$alter->toString(), $alter->statement->name] // => ['ALTER DATABASE CHARACTER SET latin1 READ ONLY DEFAULT', null]Properties§
public list<DatabaseOption> $optionspublic Name|null $nameMethods§
public function __construct(public Name|null $name, list<DatabaseOption> $options)Parameters
$name | Name|null | The database name; null for the current database |
$options | list<DatabaseOption> | The options in written order; at least one |
Throws
InvalidConstruction When there is no optionCalls 2
- static-call Check::listOf() line 46
- class-const DatabaseOption::class() line 46
public function deriveStatement(Derivation $derivation): voidHas nothing to derive: a database is no relation.
Parameters
$derivation | Derivation |
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 61
- method-call Output::name() line 63
- class-const NameUse::Qualifier() line 63
- method-call Output::node() line 66
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
AlterDatabaseTestcalls