classHexLiteral
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.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT 0x1f AS h');
[$query->statement->columns[0]->expression->digits, $query->toString()] // => ['1F', 'SELECT 0x1F AS h']new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\HexLiteral('1f') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstructionnew \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\HexLiteral('') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstructionProperties§
public string $digitsMethods§
public function __construct(public string $digits)Parameters
$digits | string | The hexadecimal digits in upper case, without prefix or separators |
Calls 2
- static-call Check::input() line 48
- function-call
preg_matchline 48
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives INTEGER, or the problem of a literal wider than 64 bits.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 10
- function-call
strlenline 56 - function-call
ltrimline 56 - new Misuse line 57
- class-const MisuseRule::HexLiteralTooBig() line 57
- method-call Derivation::report() line 58
- new ScalarFact line 60
- new Invalid line 60
- class-const Nullability::NotNull() line 60
- new Known line 63
- class-const Storage::Integer() line 63
public function render(Output $out): voidTest 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
LiteralRuleTest::testNumberLowersAHexadecimalIntegerWithUpperCasedDigitscallsTypeNameRuleTest::testSignedLowersARealAndAHexadecimalArgumentcallsOrdinalsTest::testValueLooksThroughSignsCollationsAndParenthesescallsOrdinalsTest::testValueReadsAHexadecimalLiteralOfAtMostEightSignificantDigitscallsOutputOrdinalTest::testPositionCountsFromOnecallsSignedNumberTest::testRenderWritesEveryKindOfNumericLiteralcalls