classInQuery
final class InQuery
implements Scalar
uses Snapshot
@visibility public.A membership test against the rows of a query, optionally negated.
Rule: SQLITE-IN-QUERY-001. The query is derived inside the environment of the expression. The result is INTEGER; it can be NULL when the operand or a compared column can be, and it depends on the missing inputs when the shape of the query is open. The query returns 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.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT 1 IN (SELECT 2)');
[$query->statement->columns[0]->expression->negated, $query->field(0)->nullability] // => [false, \SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability::NotNull]Properties§
public Scalar $operandpublic Query $querypublic bool $negated = falseMethods§
public function __construct(
public Scalar $operand,
public Query $query,
public bool $negated = false,
)Parameters
$operand | Scalar | The tested expression |
$query | Query | The query |
$negated | bool | Whether NOT is written before IN |
Calls 4
- static-call Check::input() line 49
- method-call Precedence::closing() line 49
- new Precedence line 49
- class-const Precedence::EQUALITY() line 49
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand, the query and the result.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 9
- method-call Derivation::scalar() line 57
- method-call Derivation::query() line 59
- method-call RowValueUse::membership() line 61
- new RowValueUse line 61
- function-call
countline 61 - class-const Nullability::Dependent() line 63
- new ScalarFact line 69
- new Known line 69
- class-const Storage::Integer() line 69
public function render(Output $out): voidWrites the test.
Parameters
$out | Output |
Calls 2
- method-call Output::node() line 77
- method-call Output::keyword() line 79
Test cases 6§
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 2
Relations§
Instantiated in 1
Type checks 2
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Expression\Limits::classify() packages/sql-semantics-sqlite/src/Rules/Definition/Expression/Limits.php:120
- instanceof SqlSemantics\Platform\Sqlite\Rules\Expression\Precedence::edges() packages/sql-semantics-sqlite/src/Rules/Expression/Precedence.php:127