final class CastResult
Restricted visibility: declared "@visibility SqlSemantics\Platform\MySql". Code outside that scope must not name this declaration.

Derives the type and NULL fact of a cast to a target type.

Rule: MYSQL-CAST-RESULT-001. BINARY[(n)] is VARBINARY[(n)]; CHAR[(n)] is VARCHAR[(n)] with its character set attribute, NCHAR the national VARCHAR; SIGNED and UNSIGNED are BIGINT; DATE, TIME[(p)], DATETIME[(p)], YEAR and DECIMAL[(m[,d])] are those types; JSON is JSON; DOUBLE is DOUBLE; FLOAT is FLOAT without a precision or with one of at most 24 and DOUBLE otherwise; REAL is FLOAT under the session mode REAL_AS_FLOAT and DOUBLE otherwise: the profile does not hold the mode, so the type is the known choice of FLOAT and DOUBLE; the spatial targets are their geometry types. A cast to a temporal type or YEAR yields NULL for a value that is not a valid date or time, so it can always be NULL; every other cast is NULL only when its operand is. Terminates: no recursion. Source: https://dev.mysql.com/doc/refman/8.4/en/cast-functions.html#function_cast. Status: Implemented.

Methods§

public function type(CastTarget $target): TypeFact

Answers the type of a cast to a target.

Parameters

$targetCastTarget

Returns

Test cases 1
Called from 1
Calls 43
public function nullability(CastTarget $target, Nullability $operand): Nullability

Answers the NULL fact of a cast to a target of an operand with a NULL fact.

Parameters

$targetCastTarget
$operandNullability
Test cases 1
Called from 1
Calls 6

Private surface 1§

Implementation details, listed for orientation only.

private const SPATIAL = ['POINT' => \SqlSemantics\Platform\MySql\Statement\Type\Kind\SpatialKind::Point…

Test cases 2§

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

Dedicated tests 2

Relations§

Instantiated in 1
Method calls 2