classQuantifiedComparison
final class QuantifiedComparison
implements Scalar
uses Snapshot
@visibility public.A comparison with every or any row of a subquery: x op ALL|ANY (SELECT …) (Item_allany_subselect).
It belongs to the bool_pri level like the plain comparisons and takes a bool_pri operand (MYSQL-PRECEDENCE-001).
Rule: MYSQL-QUANTIFIED-COMPARISON-001. Facts: 1, 0 or NULL, an integer; NULL fact by MYSQL-SUBQUERY-ROWS-001 (<=> with ALL or ANY is still NULL when no row decides). Terminates: the operand and the query are strict parts. Source: https://dev.mysql.com/doc/refman/8.4/en/any-in-some-subqueries.html, https://dev.mysql.com/doc/refman/8.4/en/all-subqueries.html. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a >= ALL (SELECT 1)');
[$query->statement->where->operator->value, $query->statement->where->quantifier->value] // => ['>=', 'ALL']Properties§
public Scalar $operandpublic ComparisonOperator $operatorpublic Quantifier $quantifierpublic Query $queryMethods§
public function __construct(
public Scalar $operand,
public ComparisonOperator $operator,
public Quantifier $quantifier,
public Query $query,
)Parameters
$operand | Scalar | The compared expression |
$operator | ComparisonOperator | The comparison operator |
$quantifier | Quantifier | Whether every row or any row must satisfy the comparison |
$query | Query | The query whose rows are compared with |
Calls 4
- static-call Check::input() line 50
- method-call Precedence::fits() line 50
- new Precedence line 50
- class-const Precedence::BOOL_PRI() line 50
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operand and the query and the NULL fact of the comparison.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 6
- method-call Derivation::scalar() line 58
- method-call Derivation::query() line 59
- method-call Operands::truth() line 61
- new Operands line 61
- method-call SubqueryRows::test() line 61
- new SubqueryRows line 61
public function render(Output $out): voidWrites the operand, the operator, the quantifier and the query in parentheses.
Parameters
$out | Output |
Calls 1
- method-call Output::node() line 69
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.