final class DefaultWord
    implements ColumnConstraint
    uses Snapshot
Public API: explicitly declared with @visibility public.

A DEFAULT column constraint whose value is written as an identifier.

Rule: SQLITE-COLUMN-DEFAULT-WORD-001. SQLite reads an identifier after DEFAULT as the text of its name, never as a column. The unquoted words TRUE and FALSE are the exception: they are the integers 1 and 0. A quoted "true" is the text again, so the word is kept with its quoting. Source: https://sqlite.org/lang_createtable.html#the_default_clause (grammar ccons ::= DEFAULT scantok id), https://sqlite.org/lang_expr.html#boolean_expressions. Status: Implemented.

Telling the text default from the truth defaultdoctest
$semantics = new \SqlSemantics\Platform\Sqlite\Semantics();
    $text = $semantics->analyze('CREATE TABLE t (a DEFAULT unknown)')->statement->columns[0]->constraints[0];
    $truth = $semantics->analyze('CREATE TABLE t (a DEFAULT TRUE)')->statement->columns[0]->constraints[0];
    [$text->truth(), $text->word->name->value, $truth->truth()] // => [null, 'unknown', true]

Properties§

public Word $word

Methods§

public function __construct(public Word $word)

Parameters

$wordWordThe identifier with its quoting
Calls 2
public function truth(): ?bool

Answers the truth value of an unquoted TRUE or FALSE, or null when the word is a text default.

Returns

?bool
Test cases 2
Calls 1
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): void

Derives nothing: the word is a constant.

Parameters

$derivationDerivation
$scopeConstraintScope
public function render(Output $out): void

Writes the clause.

Parameters

$outOutput
Calls 1

Test cases 8§

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 5

Relations§

Instantiated in 1
Type checks 3
Type declarations 2