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

The bare word TRUE or FALSE used as a value: a column of that name when one resolves, otherwise the integer 1 or 0.

Rule: SQLITE-TRUTH-WORD-001. TRUE and FALSE are no keywords. SQLite looks the unquoted, unqualified word up as a column first and reads it as the boolean constant only when no such column is visible. Facts: those of the column when one resolves; INTEGER and never NULL when none can; dependent when the answer depends on missing inputs. Source: https://sqlite.org/lang_expr.html#boolean_expressions. Status: Implemented.

Reading TRUE as the integer constantdoctest
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT true AS t', []);
    [$query->statement->columns[0]->expression->value, $query->field(0)->type->descriptor, $query->toString()] // => [true, \SqlSemantics\Platform\Sqlite\Statement\Type\Storage::Integer, 'SELECT TRUE AS t']

Properties§

public bool $value

Methods§

public function __construct(public bool $value)

Parameters

$valueboolWhether the word is TRUE
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

Resolves the word as a column and falls back to the constant when no column of that name is visible.

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the bare word.

Parameters

$outOutput
Calls 1

Test cases 6§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 2
Other tests reaching this symbol 4

Relations§

Instantiated in 1
Type checks 6
Type declarations 1