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

A postfix test for NULL: ISNULL, NOTNULL or NOT NULL.

Rule: SQLITE-NULL-TEST-001. The result is the INTEGER 0 or 1 and never NULL. The operand may not end in an operator weaker than the equality group (SQLITE-PRECEDENCE-001). Source: https://sqlite.org/lang_expr.html#operators_and_parse_affecting_attributes. Status: Implemented.

Reading a NULL testdoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT a ISNULL FROM t');
    [$query->statement->columns[0]->expression->form, $query->field(0)->nullability] // => [\SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\NullTestForm::IsNull, \SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability::NotNull]
Refusing an operand that the test would not cover when writtendoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT a OR b FROM t');
    new \SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\NullTest($query->statement->columns[0]->expression, \SqlSemantics\Platform\Sqlite\Statement\Expression\Operator\NullTestForm::IsNull) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public Scalar $operand

Methods§

public function __construct(public Scalar $operand, public NullTestForm $form)

Parameters

$operandScalarThe tested expression
$formNullTestFormThe spelling of the test
Calls 4
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand; the test is an INTEGER that is never NULL.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operand and the test.

Parameters

$outOutput
Calls 5

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 2
Type checks 1