classInQuery
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.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a NOT IN (SELECT 1)');
$query->statement->where->negated // => trueProperties§
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 whose rows are searched |
$negated | bool | Whether NOT is written before IN |
Calls 5
- static-call Check::input() line 46
- method-call Precedence::fits() line 46
- new Precedence line 46
- class-const Precedence::PREDICATE() line 46
- class-const Precedence::BIT_EXPR() line 46
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand and the query and the NULL fact of the test.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 6
- method-call Derivation::scalar() line 54
- method-call Derivation::query() line 55
- method-call Operands::truth() line 57
- new Operands line 57
- method-call SubqueryRows::test() line 57
- new SubqueryRows line 57
public function render(Output $out): voidWrites the operand, the optional NOT, IN and the query in parentheses.
Parameters
$out | Output |
Calls 2
- method-call Output::node() line 65
- method-call Output::keyword() line 67
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
- new SqlSemantics\Platform\MySql\Lowering\Expression\PredicateRule::operation() packages/sql-semantics-mysql/src/Lowering/Expression/PredicateRule.php:88
- new SqlSemantics\Platform\MySql\Lowering\Expression\PredicateRule::operation() packages/sql-semantics-mysql/src/Lowering/Expression/PredicateRule.php:89