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

The logical negation written NOT expr at the precedence of the expr level (Item_func_not).

It binds tighter than AND and looser than every comparison, so NOT a = b negates the comparison. Under HIGH_NOT_PRECEDENCE the lexer reads every NOT as the tight negation !, which is a Unary, so this form does not exist in that mode and is rejected by the derivation.

Rule: MYSQL-NOT-001. Facts: 1, 0 or NULL, an integer; NULL when the operand is. Terminates: the operand is a strict part. Source: https://dev.mysql.com/doc/refman/8.4/en/logical-operators.html#operator_not, https://dev.mysql.com/doc/refman/8.4/en/sql-mode.html#sqlmode_high_not_precedence. Status: Implemented.

Negating a comparisondoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE NOT a = 1');
    $query->statement->where->operand instanceof \SqlSemantics\Platform\MySql\Statement\Expression\Comparison // => true

Properties§

public Scalar $operand

Methods§

public function __construct(public Scalar $operand)

Parameters

$operandScalarThe negated expression
Calls 4
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand; the negation is NULL when the operand is.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes NOT and the operand.

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 4
Other tests reaching this symbol 3

Relations§

Instantiated in 1
Type checks 1