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

A membership test in the rows of a subquery: x [NOT] IN (SELECT …) (Item_in_subselect).

The operand is a bit_expr (MYSQL-PRECEDENCE-001).

Rule: MYSQL-IN-QUERY-001. Facts: 1, 0 or NULL, an integer; NULL fact by MYSQL-SUBQUERY-ROWS-001; the operand must have as many columns as the subquery. Terminates: the operand and the query are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/any-in-some-subqueries.html. Status: Implemented.

Testing membership in a subquerydoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a NOT IN (SELECT 1)');
    $query->statement->where->negated // => true

Properties§

public Scalar $operand
public Query $query
public bool $negated = false

Methods§

public function __construct(
    public Scalar $operand,
    public Query $query,
    public bool $negated = false,
)

Parameters

$operandScalarThe tested expression
$queryQueryThe query whose rows are searched
$negatedboolWhether NOT is written before IN
Calls 5
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the operand and the query and the NULL fact of the test.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

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

Parameters

$outOutput
Calls 2

Test cases 3§

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

Dedicated tests 2
Other tests reaching this symbol 1

Relations§

Instantiated in 2
Type checks 1