classNullTest
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.
$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]$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\InvalidConstructionProperties§
public Scalar $operandpublic NullTestForm $formMethods§
public function __construct(public Scalar $operand, public NullTestForm $form)Parameters
$operand | Scalar | The tested expression |
$form | NullTestForm | The spelling of the test |
Calls 4
- static-call Check::input() line 46
- method-call Precedence::closing() line 46
- new Precedence line 46
- class-const Precedence::EQUALITY() line 46
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand; the test is an INTEGER that is never NULL.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 5
- method-call Derivation::scalar() line 54
- new ScalarFact line 56
- new Known line 56
- class-const Storage::Integer() line 56
- class-const Nullability::NotNull() line 56
public function render(Output $out): voidWrites the operand and the test.
Parameters
$out | Output |
Calls 5
- method-call Output::node() line 64
- class-const NullTestForm::IsNull() line 66
- method-call Output::keyword() line 66
- class-const NullTestForm::NotNull() line 67
- class-const NullTestForm::NotNullWords() line 68
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
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\PredicateRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/PredicateRule.php:52
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\PredicateRule::expression() packages/sql-semantics-sqlite/src/Lowering/Expression/PredicateRule.php:53