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

An expression with an explicit collating sequence for the comparisons it takes part in.

Rule: SQLITE-COLLATE-001. The operator changes no value: the type and the NULL fact are those of the operand, and the name resolution stays with the operand. The operand is a single value (SQLITE-ROW-VALUE-USE-001): a collated row value is invalid. The operand must bind at least as tightly as COLLATE (SQLITE-PRECEDENCE-001). Source: https://sqlite.org/lang_expr.html#collate_operator, https://sqlite.org/datatype3.html#collation. Status: Implemented.

Reading the collation of an expressiondoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT a COLLATE NOCASE FROM t');
    $query->statement->columns[0]->expression->collation->value // => 'NOCASE'
Refusing an operand that would be read back differentlydoctest
$sum = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT 1 + 2')->statement->columns[0]->expression;
    new \SqlSemantics\Platform\Sqlite\Statement\Expression\Collate($sum, new \SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name('NOCASE')) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public Scalar $operand
public Name $collation

Methods§

public function __construct(public Scalar $operand, public Name $collation)

Parameters

$operandScalarThe collated expression
$collationNameThe collating sequence name
Calls 4
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand; the collation changes no value.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operand and the collation.

Parameters

$outOutput
Calls 2

Test cases 24§

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

Dedicated tests 4
Other tests reaching this symbol 20

Relations§

Instantiated in 2
Type checks 11