classTruthTest
final class TruthTest
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A test of a value against a truth value: IS [NOT] TRUE|FALSE|UNKNOWN (Item_func_istrue, Item_func_isfalse, …).
The test belongs to the expr level and takes a bool_pri operand, so a truth test cannot test another truth test without a grouping.
Rule: MYSQL-TRUTH-TEST-001. Facts: always 1 or 0, an integer that is never NULL. Terminates: the operand is a strict part. Source: https://dev.mysql.com/doc/refman/8.4/en/comparison-operators.html#operator_is. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a = 1 IS NOT TRUE');
[$query->statement->where->negated, $query->statement->where->truth->value] // => [true, 'TRUE']Properties§
public Scalar $operandpublic Truth $truthpublic bool $negated = falseMethods§
public function __construct(
public Scalar $operand,
public Truth $truth,
public bool $negated = false,
)Parameters
$operand | Scalar | The tested expression |
$truth | Truth | The truth value compared with |
$negated | bool | Whether NOT is written after IS |
Calls 4
- static-call Check::input() line 45
- method-call Precedence::fits() line 45
- new Precedence line 45
- class-const Precedence::BOOL_PRI() line 45
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand; the test is never NULL.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- new Operands line 53
- method-call Operands::single() line 54
- method-call Derivation::scalar() line 54
- method-call Operands::truth() line 56
- class-const Nullability::NotNull() line 56
public function render(Output $out): voidWrites the operand, IS, the optional NOT and the truth value.
Parameters
$out | Output |
Test cases 1
Calls 2
- method-call Output::node() line 64
- method-call Output::keyword() line 66
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 5
ConditionRuleTest::testUnitLowersNotAndTheTruthTestscallsPrecedenceTest::testAbsorbsTellsWhetherAFollowingOperatorBindsIntoTheRightEdgecallsNullTestTest::testATruthTestOperandIsRejectedcallsArithmeticTest::testARightOperandStartingWithALeadingIntervalIsRejectedcallsQuantifiedComparisonTest::testATruthTestOperandIsRejectedcalls