classNot
final class Not
implements Scalar
uses Snapshot
@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.
$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 // => trueProperties§
public Scalar $operandMethods§
public function __construct(public Scalar $operand)Parameters
$operand | Scalar | The negated expression |
Calls 4
- static-call Check::input() line 45
- method-call Precedence::opening() line 45
- new Precedence line 45
- class-const Precedence::NEGATION() line 45
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand; the negation is NULL when the operand is.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- static-call Check::input() line 53
- new Operands line 54
- method-call Operands::single() line 55
- method-call Derivation::scalar() line 55
- method-call Operands::truth() line 57
public function render(Output $out): voidWrites NOT and the operand.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::keyword() line 65
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.