final class Exists
    implements Scalar
    uses Snapshot
Public API: explicitly declared with @visibility public.

A test whether a query returns at least one row.

Rule: SQLITE-EXISTS-001. The query is derived inside the environment of the expression. The result is the INTEGER 0 or 1 and never NULL. Source: https://sqlite.org/lang_expr.html#the_exists_operator. Status: Implemented.

Reading the facts of EXISTSdoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT EXISTS (SELECT 1 FROM t)');
    [$query->field(0)->type->descriptor, $query->field(0)->nullability] // => [\SqlSemantics\Platform\Sqlite\Statement\Type\Storage::Integer, \SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability::NotNull]

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; the test is an INTEGER that is never NULL.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the test.

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 4
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Type checks 1