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.

Altering the current databasedoctest
$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> $options
public Name|null $name

Methods§

public function __construct(public Name|null $name, list<DatabaseOption> $options)

Parameters

$nameName|nullThe database name; null for the current database
$optionslist<DatabaseOption>The options in written order; at least one

Throws

InvalidConstruction When there is no option
Calls 2
public function deriveStatement(Derivation $derivation): void

Has nothing to derive: a database is no relation.

Parameters

$derivationDerivation
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