classDatabaseCharset
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.
$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 $charsetMethods§
public function __construct(public CharsetName $charset)Parameters
$charset | CharsetName | The character set |
public function render(Output $out): voidTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
DatabaseCharsetTestcalls