classConvertCharset
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.
$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 $charsetpublic CollationName|null $collation = nullMethods§
public function __construct(
public CharsetName $charset,
public CollationName|null $collation = null,
)Parameters
$charset | CharsetName | The character set, or DEFAULT |
$collation | CollationName|null | The COLLATE clause, when written |
public function deriveCommand(Derivation $derivation, Environment $scope): voidDerives nothing: the action holds no expression.
Parameters
$derivation | Derivation | |
$scope | Environment |
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
ConvertCharsetTestcalls