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

A decimal integer literal, kept as its exact digits.

Digit separators are not part of the value and are not kept.

Rule: SQLITE-INTEGER-LITERAL-001. A literal that fits a signed 64-bit integer has storage class INTEGER; a larger one is read as REAL. Source: https://sqlite.org/lang_expr.html#literal_values_constants_. Status: Implemented.

Keeping the exact digits of a literaldoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT 9223372036854775808');
    [$query->statement->columns[0]->expression->digits, $query->field(0)->type->descriptor] // => ['9223372036854775808', \SqlSemantics\Platform\Sqlite\Statement\Type\Storage::Real]
Refusing text that is not a digit sequencedoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\IntegerLiteral('1_000') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction
Refusing an empty digit sequencedoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\IntegerLiteral('') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction
Refusing a signdoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\IntegerLiteral('-1') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public string $digits

Methods§

public function __construct(public string $digits)

Parameters

$digitsstringThe decimal digits without sign or separators
Calls 2
public function fits(): bool
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the storage class from the magnitude.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the digits.

Parameters

$outOutput
Calls 1

Test cases 151§

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

Dedicated tests 5
Other tests reaching this symbol 146

Relations§

Instantiated in 1
Type checks 2
Type declarations 2