classInList
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.
$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]$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\InvalidConstructionProperties§
public list<Scalar> $itemspublic Scalar $operandpublic bool $negated = falseMethods§
public function __construct(
public Scalar $operand,
list<Scalar> $items,
public bool $negated = false,
)Parameters
$operand | Scalar | The tested expression |
$items | list<Scalar> | The values in order; possibly none |
$negated | bool | Whether NOT is written before IN |
Calls 6
- static-call Check::listOf() line 55
- class-const Scalar::class() line 55
- static-call Check::input() line 56
- method-call Precedence::closing() line 56
- new Precedence line 56
- class-const Precedence::EQUALITY() line 56
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand, the values and the result.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 8
- method-call Derivation::scalar() line 64
- function-call
countline 69 - method-call RowValueUse::elements() line 71
- new RowValueUse line 71
- new ScalarFact line 73
- new Known line 73
- class-const Storage::Integer() line 73
- class-const Nullability::NotNull() line 73
public function render(Output $out): voidWrites the test.
Parameters
$out | Output |
Calls 2
- method-call Output::node() line 81
- method-call Output::keyword() line 83
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.