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.

Reading the facts of a scalar subquerydoctest
$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 $query

Methods§

public function __construct(public Query $query)

Parameters

$queryQueryThe query
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Derives the query and the value it yields.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

Calls 11
public function render(Output $out): void

Writes the query in parentheses.

Parameters

$outOutput
Calls 1

Test 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