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

A DEFAULT column constraint whose value is an expression in parentheses.

Rule: SQLITE-COLUMN-DEFAULT-EXPRESSION-001. The expression is evaluated once for each inserted row that gives the column no value. It must be constant: "an expression is considered constant if it contains no

  • sub-queries, column or table references, bound parameters, or string
  • literals enclosed in double-quotes". It is therefore derived at a position

that sees no relation, where a column name is a missing column. Source: https://sqlite.org/lang_createtable.html#the_default_clause. Status: Implemented.

Reporting a column reference in a default expressiondoctest
(new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE TABLE t (a, b DEFAULT (a))') // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\SemanticException: Column a does not exist.

Properties§

public Scalar $expression

Methods§

public function __construct(public Scalar $expression)

Parameters

$expressionScalarThe expression written in parentheses
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): void

Derives the expression where no column is visible.

Parameters

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

Writes the clause.

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

Relations§

Instantiated in 1
Type checks 5
Type declarations 2