classScalarSubquery
final class ScalarSubquery
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A query in parentheses used as a value: the first row of its result, or NULL when it has no row.
Rule: SQLITE-SCALAR-SUBQUERY-001. The query is derived inside the environment of the expression, so it can refer to the enclosing queries. A query of one column yields the type of that column and can always be NULL; a query of several columns is a row value; a query whose shape is open depends on the missing inputs; a query without any column is invalid. Source: https://sqlite.org/lang_expr.html#subquery_expressions. Status: Implemented.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT (SELECT 1)');
[$query->field(0)->type->descriptor, $query->field(0)->nullability] // => [\SqlSemantics\Platform\Sqlite\Statement\Type\Storage::Integer, \SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability::Nullable]Properties§
public Query $queryMethods§
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the query and the value it yields.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 11
- method-call Derivation::query() line 53
- new ScalarFact line 56
- new Dependent line 56
- class-const Nullability::Nullable() line 56
- function-call
countline 58 - new ArityMismatch line 59
- class-const ArityRule::ScalarSubquery() line 59
- method-call Derivation::report() line 60
- new Invalid line 62
- new Known line 65
- new Vector line 65
public function render(Output $out): voidTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 2
Relations§
Instantiated in 1
Type checks 4
- 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\Definition\Query\ColumnTyping::text() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ColumnTyping.php:91
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::of() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:88
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ValueKinds::of() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ValueKinds.php:104