classCharsetConversion
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.
$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 $operandpublic CharsetName $charsetMethods§
public function __construct(public Scalar $operand, public CharsetName $charset)Parameters
$operand | Scalar | The converted expression |
$charset | CharsetName | The character set; not DEFAULT |
Calls 1
- static-call Check::input() line 48
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand; the result is a string in the character set.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 13
- method-call Operands::single() line 56
- new Operands line 56
- method-call Derivation::scalar() line 56
- static-call Check::invariant() line 58
- function-call
strtolowerline 59 - new Binary line 59
- class-const BinaryKind::VarBinary() line 59
- new Character line 59
- class-const CharacterKind::VarChar() line 59
- new CharsetAttribute line 59
- class-const CharsetForm::Named() line 59
- new ScalarFact line 61
- new Known line 61
public function render(Output $out): voidWrites CONVERT, the operand, USING and the character set in parentheses.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 69
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.