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

A membership test against the rows of a named table or of a table-valued function, optionally negated.

Rule: SQLITE-IN-TABLE-001. x IN t reads every row of the relation t and x IN f(args) every row of a table-valued function. The use of the relation is recorded as a table use of the operation; without arguments its shape follows SQLITE-TABLE-SHAPE-001, with arguments SQLITE-TABLE-CALL-001. The result is INTEGER; it can be NULL when the operand or a compared column can be, and depends on the missing inputs when the shape of the relation is open. The relation has as many columns as the operand has values (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 relation of a membership testdoctest
$semantics = new \SqlSemantics\Platform\Sqlite\Semantics();
    $table = $semantics->analyze('CREATE TABLE t (a INTEGER NOT NULL)');
    $query = $semantics->analyze('SELECT 1 IN t', [$table]);
    [$query->statement->columns[0]->expression->table->name->value, $query->facts->relation($query->statement->columns[0]->expression)->table->table === $table->declarations()[0], $query->field(0)->nullability] // => ['t', true, \SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability::NotNull]

Properties§

public list<Scalar>|null $arguments
public Scalar $operand
public QualifiedName $table
public bool $negated = false

Methods§

public function __construct(
    public Scalar $operand,
    public QualifiedName $table,
    list<Scalar>|null $arguments = null,
    public bool $negated = false,
)

Parameters

$operandScalarThe tested expression
$tableQualifiedNameThe relation or function name
$argumentslist<Scalar>|nullThe arguments of a table-valued function; null when no argument list is written
$negatedboolWhether NOT is written before IN
Calls 6
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand, the arguments, the use of the relation and the result.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the test.

Parameters

$outOutput
Calls 6

Test cases 11§

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

Dedicated tests 8
Other tests reaching this symbol 3

Relations§

Instantiated in 1
Type checks 3