classBinaryCast
final class BinaryCast
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.The BINARY operator: BINARY x, the cast of a value to a binary string (Item_typecast_char with the binary character set).
It binds as tightly as COLLATE and groups to the right, so BINARY a COLLATE c casts the collated value (MYSQL-PRECEDENCE-001). The operator is deprecated from MySQL 8.0.27 and still accepted.
Rule: MYSQL-BINARY-OPERATOR-001. Facts: a VARBINARY; 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#operator_binary. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM t WHERE BINARY a = 'x'");
$query->facts->scalar($query->statement->where->left)->type->descriptor->name() // => 'VARBINARY'Properties§
public Scalar $operandMethods§
public function __construct(public Scalar $operand)Parameters
$operand | Scalar | The cast expression |
Calls 4
- static-call Check::input() line 46
- method-call Precedence::opening() line 46
- new Precedence line 46
- class-const Precedence::PREFIX() line 46
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand; the result is a binary string.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- method-call Operands::single() line 54
- new Operands line 54
- method-call Derivation::scalar() line 54
- new ScalarFact line 56
- new Known line 56
- new Binary line 56
- class-const BinaryKind::VarBinary() line 56
public function render(Output $out): voidTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.