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.

Testing a comparisondoctest
$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 $operand
public Truth $truth
public bool $negated = false

Methods§

public function __construct(
    public Scalar $operand,
    public Truth $truth,
    public bool $negated = false,
)

Parameters

$operandScalarThe tested expression
$truthTruthThe truth value compared with
$negatedboolWhether NOT is written after IS
Calls 4
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand; the test is never NULL.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operand, IS, the optional NOT and the truth value.

Parameters

$outOutput
Test cases 1
Calls 2

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

Relations§

Instantiated in 1
Type checks 1