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

An unsigned number literal, kept as its exact text.

Rule: MYSQL-NUMBER-LITERAL-001. Facts: an integer that fits a signed 64-bit integer is BIGINT, one that fits only unsigned is BIGINT UNSIGNED; an exact number with a decimal point or beyond the 64-bit range is DECIMAL; a number with an exponent is DOUBLE; never NULL. Precision: the type family is exact; precision and scale of a DECIMAL literal are not derived. Diagnostics: none. Terminates: constant work. Source: https://dev.mysql.com/doc/refman/8.4/en/number-literals.html, https://dev.mysql.com/doc/refman/8.4/en/precision-math-numbers.html. Status: Implemented.

Keeping the exact text of a numberdoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a = 1.50');
    [$query->statement->where->right->text, $query->statement->where->right->form] // => ['1.50', \SqlSemantics\Platform\MySql\Statement\Literal\NumberForm::Decimal]

Properties§

public NumberForm $form
public string $text

Methods§

public function __construct(public string $text)

Parameters

$textstringThe number exactly as written, without sign
Calls 2
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the numeric type; a literal is never NULL.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the exact text.

Parameters

$outOutput
Calls 1

Test cases 269§

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

Dedicated tests 11
Other tests reaching this symbol 258

Relations§

Instantiated in 4
Method calls 1
Constant reads 1
Type checks 12
Type declarations 6