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

A hexadecimal integer literal, kept as its exact hexadecimal digits in upper case.

Rule: SQLITE-HEX-LITERAL-001. A hexadecimal literal is the two's complement 64-bit integer its digits spell and has storage class INTEGER; more than 16 significant digits are rejected by SQLite as too big. Source: https://sqlite.org/lang_expr.html#literal_values_constants_. Status: Implemented.

Reading the digits of a hexadecimal literaldoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT 0x1f AS h');
    [$query->statement->columns[0]->expression->digits, $query->toString()] // => ['1F', 'SELECT 0x1F AS h']
Refusing lower-case digits, which are another spelling of the same valuedoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\HexLiteral('1f') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction
Refusing an empty digit sequencedoctest
new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\HexLiteral('') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public string $digits

Methods§

public function __construct(public string $digits)

Parameters

$digitsstringThe hexadecimal digits in upper case, without prefix or separators
Calls 2
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives INTEGER, or the problem of a literal wider than 64 bits.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the prefix and the digits.

Parameters

$outOutput
Calls 1

Test cases 8§

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

Dedicated tests 2
Other tests reaching this symbol 6

Relations§

Instantiated in 1
Type checks 2
Type declarations 2