classOdbcEscape
final class OdbcEscape
implements Scalar
uses Snapshot
@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.
$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 $kindpublic Scalar $operandMethods§
public function __construct(public Name $kind, public Scalar $operand)Parameters
$kind | Name | The escape keyword |
$operand | Scalar | The escaped expression |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand and, for a temporal escape over a string, the temporal type.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- method-call Derivation::scalar() line 61
- class-const OdbcEscape::KINDS() line 62
- function-call
strtolowerline 62 - new ScalarFact line 64
- new Known line 64
- new Temporal line 64
- class-const Nullability::NotNull() line 64
public function render(Output $out): voidWrites the braces around the kind and the operand.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::symbol() line 75
- class-const NameUse::Label() line 75
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.