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

An ODBC escape: { kind expr } (PTI_odbc_date).

With the kind d, t or ts (in any letter case) and a string literal, the server reads a DATE, TIME or DATETIME literal; with any other kind or operand the escape stands for its operand.

Rule: MYSQL-ODBC-ESCAPE-001. Facts: the temporal literal type and never NULL for the temporal kinds over a string literal; otherwise the facts of the operand. Terminates: the operand is a strict part. Source: https://dev.mysql.com/doc/refman/8.4/en/date-and-time-literals.html. Status: Implemented.

Typing an ODBC datedoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze("SELECT a FROM t WHERE a = { d '2024-01-31' }");
    $query->facts->scalar($query->statement->where->right)->type->descriptor->name() // => 'DATE'

Properties§

public Name $kind
public Scalar $operand

Methods§

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

Parameters

$kindNameThe escape keyword
$operandScalarThe escaped expression
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand and, for a temporal escape over a string, the temporal type.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the braces around the kind and the operand.

Parameters

$outOutput
Test cases 1
Calls 2

Private surface 1§

Implementation details, listed for orientation only.

private const KINDS = ['d' => \SqlSemantics\Platform\MySql\Statement\Type\Kind\TemporalKind::Date, 't…

Test cases 3§

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

Dedicated tests 2
Other tests reaching this symbol 1

Relations§

Instantiated in 1