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

An unqualified word in double quotes used as a value: a column when one resolves, otherwise a string.

This is a different request from a column use: SQLite first looks the word up as a column name and, when no column of that name is visible, reads the word as a string literal instead of reporting an error.

Rule: SQLITE-DOUBLE-QUOTED-WORD-001. Facts: when the lookup of SQLITE-COLUMN-LOOKUP-001 finds a column or a result alias, the facts of that column; when it certainly finds nothing, TEXT and never NULL with no resolution; when the answer depends on missing inputs, a conditional resolution and a dependent type. Source: https://sqlite.org/quirks.html#dblquote. Status: Implemented.

Reading a double-quoted word that is no column as textdoctest
$semantics = new \SqlSemantics\Platform\Sqlite\Semantics();
    $table = $semantics->analyze('CREATE TABLE t (a INTEGER)');
    $query = $semantics->analyze('SELECT "a", "b" FROM t', [$table]);
    [$query->field(0)->column() === $table->declarations()[0]->columns[0], $query->field(1)->type->descriptor, $query->toString()] // => [true, \SqlSemantics\Platform\Sqlite\Statement\Type\Storage::Text, 'SELECT "a", "b" FROM t']

Properties§

public Name $word

Methods§

public function __construct(public Name $word)

Parameters

$wordNameThe decoded word
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFact

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

Parameters

$derivationDerivation
$environmentEnvironment

Returns

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

Writes the word in double quotes with each double quote doubled.

Parameters

$outOutput
Calls 2

Test cases 8§

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 6

Relations§

Instantiated in 1
Type checks 14
Type declarations 1