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

A number literal written with a sign at a position that takes a signed literal, such as a column default.

In an expression a sign is the unary operator; at these positions the grammar reads the sign as part of the literal.

Rule: MYSQL-SIGNED-LITERAL-001. Facts: the type of the number, except that the negation of an integer beyond the signed 64-bit range, 9223372036854775808 and above, is DECIMAL: the server negates an unsigned integer literal through a decimal value (Item_uint::neg in sql/item.cc); never NULL. Diagnostics: none. Source: https://dev.mysql.com/doc/refman/8.4/en/number-literals.html, https://github.com/mysql/mysql-server/blob/8.4/sql/item.cc. Status: Implemented.

Holding a negative literaldoctest
$literal = new \SqlSemantics\Platform\MySql\Statement\Literal\SignedLiteral(true, new \SqlSemantics\Platform\MySql\Statement\Literal\NumberLiteral('5'));
    [$literal->negative, $literal->number->text] // => [true, '5']

Properties§

public bool $negative
public NumberLiteral $number

Methods§

public function __construct(public bool $negative, public NumberLiteral $number)

Parameters

$negativeboolWhether the sign is minus; otherwise plus
$numberNumberLiteralThe unsigned number
public function render(Output $out): void

Writes the sign and the number.

Parameters

$outOutput
Test cases 1
Calls 1

Test cases 7§

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

Dedicated tests 6
Other tests reaching this symbol 1

Relations§

Instantiated in 2