final class Word
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

A word at a position where SQLite looks at the written text: the name and how it is quoted.

At most positions a quoted and an unquoted spelling of a name mean the same. At a few they do not: SQLite records a declared column type with its quotes, accepts the table options and the storage word of a generated column only without quotes, and reads an unquoted TRUE or FALSE default as a number. A word keeps the quoting so that those meanings survive.

Rule: SQLITE-WORD-001. The spelling is the name between its delimiters with each embedded closing delimiter doubled; a bracketed word cannot contain ]. Source: https://sqlite.org/lang_keywords.html. Status: Implemented.

Spelling a quoted worddoctest
$word = new \SqlSemantics\Platform\Sqlite\Statement\Lexical\Word(new \SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name('big "int"'), \SqlSemantics\Platform\Sqlite\Statement\Lexical\WordQuote::Double);
    $word->spelling() // => '"big ""int"""'
Refusing an unquoted word that is a reserved keyworddoctest
new \SqlSemantics\Platform\Sqlite\Statement\Lexical\Word(new \SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name('select')) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction
Refusing an unquoted word that is not one identifierdoctest
new \SqlSemantics\Platform\Sqlite\Statement\Lexical\Word(new \SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name('two words')) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction
Refusing a bracketed word that contains a closing bracketdoctest
new \SqlSemantics\Platform\Sqlite\Statement\Lexical\Word(new \SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name('a]b'), \SqlSemantics\Platform\Sqlite\Statement\Lexical\WordQuote::Bracket) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction

Properties§

public Name $name
public WordQuote $quote = WordQuote::Bare

Methods§

public function __construct(public Name $name, public WordQuote $quote = WordQuote::Bare)

Parameters

$nameNameThe decoded word
$quoteWordQuoteHow the word is delimited
Calls 6
public function bare(): bool
public function render(Output $out): void

Writes the word with its own quoting.

Parameters

$outOutput
Test cases 1
Calls 2

Test cases 33§

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

Dedicated tests 6
Other tests reaching this symbol 27

Relations§

Instantiated in 2
Method calls 5
Constant reads 1
Type declarations 6