final class CharsetConversion
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

A conversion of a string to a character set: CONVERT(expr USING charset) (Item_func_conv_charset).

Rule: MYSQL-CHARSET-CONVERSION-001. Facts: a VARCHAR in the named character set, or a VARBINARY for the character set binary; NULL when the operand is. Terminates: the operand is a strict part. Source: https://dev.mysql.com/doc/refman/8.4/en/cast-functions.html#function_convert. Status: Implemented.

Reading the character setdoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM t WHERE CONVERT(a USING utf8mb4) = 'x'");
    $query->statement->where->left->charset->name->value // => 'utf8mb4'

Properties§

public Scalar $operand
public CharsetName $charset

Methods§

public function __construct(public Scalar $operand, public CharsetName $charset)

Parameters

$operandScalarThe converted expression
$charsetCharsetNameThe character set; not DEFAULT
Calls 1
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand; the result is a string in the character set.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 13
public function render(Output $out): void

Writes CONVERT, the operand, USING and the character set in parentheses.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 4§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3
Other tests reaching this symbol 1

Relations§

Instantiated in 1