classScalarSubquery
final class ScalarSubquery
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A subquery used as a value: (SELECT …), a scalar or row subquery (Item_singlerow_subselect).
The subquery sees the enclosing positions as its outer scope.
Rule: MYSQL-SCALAR-SUBQUERY-001. Facts: MYSQL-SUBQUERY-ROWS-001; a subquery of one column has its type, one of several columns is a row, and either is NULL when no row is returned. Terminates: the query is a strict part. Source: https://dev.mysql.com/doc/refman/8.4/en/scalar-subqueries.html, https://dev.mysql.com/doc/refman/8.4/en/row-subqueries.html. Status: Implemented.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t WHERE a = (SELECT 1)');
$query->statement->where->right instanceof \SqlSemantics\Platform\MySql\Statement\Expression\Subquery\ScalarSubquery // => trueProperties§
public Query $queryMethods§
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the query with the enclosing position as outer scope, and the value it yields.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 3
- method-call SubqueryRows::value() line 50
- new SubqueryRows line 50
- method-call Derivation::query() line 50
public function render(Output $out): voidTest cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
Other tests reaching this symbol 6
FormRuleTest::testLowerLowersTheBracketedAndColumnFormscallsFormRuleTest::testLowerLowersTheSubqueryFormsOfMySql56callsLateOrderingTest::testRenderWritesTheOrderingAfterTheLockingClausesOfTheBlockcallsSelectTest::testDeriveQueryRefusesALateOrderingBefore56callsOrderedSetOperationTest::testDeriveQueryNeedsMySql56callsOrderedSetOperationTest::testDeriveQueryOrdersTheResultAndKeepsTheClausesOfTheLastSelectcalls