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

A membership test against a written list of values, optionally negated.

Rule: SQLITE-IN-LIST-001. The result is INTEGER. It is NULL when the operand is NULL or when no value matches and a value is NULL; with an empty list it is never NULL. Every value has the width of the operand (SQLITE-ROW-VALUE-USE-001). The operand may not end in an operator weaker than the equality group (SQLITE-PRECEDENCE-001). Source: https://sqlite.org/lang_expr.html#the_in_and_not_in_operators. Status: Implemented.

Reading the values of a membership testdoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT a NOT IN (1, 2) FROM t');
    [$query->statement->columns[0]->expression->negated, count($query->statement->columns[0]->expression->items)] // => [true, 2]
Refusing an operand that the test would not cover when writtendoctest
$or = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT a OR b FROM t')->statement->columns[0]->expression;
    new \SqlSemantics\Platform\Sqlite\Statement\Expression\Subquery\InList($or, []) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public list<Scalar> $items
public Scalar $operand
public bool $negated = false

Methods§

public function __construct(
    public Scalar $operand,
    list<Scalar> $items,
    public bool $negated = false,
)

Parameters

$operandScalarThe tested expression
$itemslist<Scalar>The values in order; possibly none
$negatedboolWhether NOT is written before IN
Calls 6
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand, the values and the result.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the test.

Parameters

$outOutput
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 4
Other tests reaching this symbol 4

Relations§

Instantiated in 1
Type checks 1