final class DatabaseCharset
    implements DatabaseOption
    uses Snapshot
Public API: explicitly declared with @visibility public.

[DEFAULT] CHARACTER SET [=] charset: the default character set of the database's tables.

DEFAULT before the option and the equals sign are optional and not written; CHARSET and CHARACTER SET are synonyms and CHARACTER SET is written, because CHARSET right after ALTER DATABASE would be read as the database name. The name DEFAULT, accepted by MySQL 5.x, takes the server's character set. Source: https://dev.mysql.com/doc/refman/8.4/en/create-database.html.

Reading the character setdoctest
$create = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('CREATE DATABASE d DEFAULT CHARACTER SET = latin1');
    [$create->toString(), $create->statement->options[0]->charset->name?->value] // => ['CREATE DATABASE d CHARACTER SET latin1', 'latin1']

Properties§

public CharsetName $charset

Methods§

public function __construct(public CharsetName $charset)

Parameters

$charsetCharsetNameThe character set
public function render(Output $out): void

Writes the option.

Parameters

$outOutput
Calls 1

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