final class ConvertCharset
    implements AlterCommand
    uses Snapshot
Public API: explicitly declared with @visibility public.

CONVERT TO CHARACTER SET name | DEFAULT [COLLATE name]: a request to convert every character column and the table default.

Mirrors PT_alter_table_convert_to_charset. DEFAULT means the character set of the database. CHARACTER SET and CHARSET are synonyms; CHARACTER SET is written. Source: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html#alter-table-character-set.

Converting a table to utf8mb4doctest
$alter = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('ALTER TABLE t CONVERT TO CHARSET utf8mb4');
    [$alter->statement->commands[0]->charset->name?->value, $alter->toString()] // => ['utf8mb4', 'ALTER TABLE t CONVERT TO CHARACTER SET utf8mb4']

Properties§

public CharsetName $charset
public CollationName|null $collation = null

Methods§

public function __construct(
    public CharsetName $charset,
    public CollationName|null $collation = null,
)

Parameters

$charsetCharsetNameThe character set, or DEFAULT
$collationCollationName|nullThe COLLATE clause, when written
public function deriveCommand(Derivation $derivation, Environment $scope): void

Derives nothing: the action holds no expression.

Parameters

$derivationDerivation
$scopeEnvironment
public function render(Output $out): void

Writes the action.

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
Type declarations 1