classCastAtLocal
final class CastAtLocal
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A cast of a value at the local time zone: CAST(expr AT LOCAL AS type [ARRAY]), which the grammar accepts and the server rejects.
Rule: MYSQL-CAST-AT-LOCAL-001. Facts: the server reports ER_NOT_SUPPORTED_YET for AT LOCAL while parsing, so the request is invalid (NotSupportedYet). Terminates: the operand is a strict part. Source: https://dev.mysql.com/doc/refman/8.4/en/cast-functions.html#function_cast (only AT TIME ZONE is documented). Status: Implemented.
(new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE CAST(a AT LOCAL AS DATE)') // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\SemanticException: This version of MySQL doesn't yet support 'AT LOCAL'.Properties§
public Scalar $operandpublic CastTarget $targetpublic bool $array = falseMethods§
public function __construct(
public Scalar $operand,
public CastTarget $target,
public bool $array = false,
)Parameters
$operand | Scalar | The cast expression |
$target | CastTarget | The target type |
$array | bool | Whether ARRAY follows the target type |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand and reports the unsupported form.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 7
- method-call Operands::single() line 50
- new Operands line 50
- method-call Derivation::scalar() line 50
- new NotSupportedYet line 51
- method-call Derivation::report() line 52
- new ScalarFact line 54
- new Invalid line 54
public function render(Output $out): voidWrites CAST, the operand, AT LOCAL AS, the target and the optional ARRAY in parentheses.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::keyword() line 62
- method-call Output::symbol() line 66
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.