final class IntegerConstant
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The value of a numeric constant written as an integer that fits 32 bits.

The scanner reads such a constant as an ICONST holding the integer, so decimal, hexadecimal, octal and binary digits and underscores between digits are spellings of the same value; it is kept as canonical decimal digits and written back that way. A larger integer is an FCONST the server keeps as written, a NumericConstant (PG-LEX-NUMBER-001). Source: https://www.postgresql.org/docs/17/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS-NUMERIC.

Reading a hexadecimal integerdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 0x1_F');
    $query->statement->targets[0]->expression->value->digits // => '31'
Rejecting digits that are not canonicaldoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Literal\IntegerConstant('007') // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public string $digits

Methods§

public function __construct(public string $digits)

Parameters

$digitsstringThe decimal digits without leading zeros, at most 2147483647
Calls 4
public function render(Output $out): void

Writes the decimal digits.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 251§

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

Dedicated tests 3
Other tests reaching this symbol 248

Relations§

Instantiated in 1
Type checks 11
Type declarations 22