classCollated
final class Collated
implements Scalar
uses Snapshot
@visibility public.A value with an explicit collation: x COLLATE collation (Item_func_set_collation).
COLLATE is the tightest operator; a chain of COLLATE clauses applies from the left (MYSQL-PRECEDENCE-001).
Rule: MYSQL-COLLATE-001. Facts: the type and NULL fact of the operand; the collation is part of the comparison semantics the server applies, and the character set of the operand must admit it, which needs the collation catalog of the server and is not checked. Terminates: the operand is a strict part. Source: https://dev.mysql.com/doc/refman/8.4/en/charset-collate.html. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM t WHERE a COLLATE utf8mb4_bin = 'x'");
$query->statement->where->left->collation->value // => 'utf8mb4_bin'Properties§
public Scalar $operandpublic Name $collationMethods§
public function __construct(public Scalar $operand, public Name $collation)Parameters
$operand | Scalar | The collated expression |
$collation | Name | The collation name |
Calls 5
- static-call Check::input() line 48
- method-call Precedence::fits() line 48
- new Precedence line 48
- class-const Precedence::COLLATION() line 48
- class-const Precedence::SIMPLE_EXPR() line 48
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand; the collated value has its facts.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- method-call Operands::single() line 56
- new Operands line 56
- method-call Derivation::scalar() line 56
- new ScalarFact line 58
public function render(Output $out): voidWrites the operand, COLLATE and the collation name.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::node() line 66
- class-const NameUse::Label() line 66
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.