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

A membership test in a list of expressions: x [NOT] IN (e1, e2 …) (Item_func_in).

A list of one element is kept as written; the server evaluates it as the equality (or inequality) with that element, which has the same facts. The operand is a bit_expr (MYSQL-PRECEDENCE-001).

Rule: MYSQL-IN-LIST-001. Facts: 1, 0 or NULL, an integer; it can be NULL when the operand or an element can. The operand and every element must have the same number of columns (MYSQL-OPERAND-COLUMNS-001). Terminates: the operand and the elements are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/comparison-operators.html#operator_in. Status: Implemented.

Reading the elements of a listdoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a NOT IN (1, 2)');
    [$query->statement->where->negated, count($query->statement->where->elements)] // => [true, 2]

Properties§

public non-empty-list<Scalar> $elements
public Scalar $operand
public bool $negated = false

Methods§

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

Parameters

$operandScalarThe tested expression
$elementslist<Scalar>The elements in order; at least one
$negatedboolWhether NOT is written before IN
Calls 7
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand and the elements, checks their widths and combines their NULL facts.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the operand, the optional NOT, IN and the elements in parentheses.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 11§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5
Other tests reaching this symbol 6

Relations§

Instantiated in 2
Type checks 1