final class TableCheck
    implements TableConstraint
    uses Snapshot
Public API: explicitly declared with @visibility public.

A CHECK table constraint.

Rule: SQLITE-TABLE-CHECK-001. The expression may refer to any column of the table and to its row identifier and is derived at a position whose only visible relation is the table being defined. The grammar accepts a conflict resolution after the constraint; "the conflict resolution algorithm for

  • CHECK constraints is always ABORT" and SQLite ignores the written one. A

bound parameter or a subquery in the condition is a diagnostic (SQLITE-DEFINITION-LIMITS-001). Source: https://sqlite.org/lang_createtable.html#check_constraints. Status: Implemented.

Reading a table checkdoctest
$create = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE TABLE t (a, b, CHECK (a < b))');
    $create->facts->scalar($create->statement->constraints[0]->items[0]->expression->right)->resolution->slot->name->value // => 'b'

Properties§

public Scalar $expression
public ConflictResolution|null $conflict = null

Methods§

public function __construct(
    public Scalar $expression,
    public ConflictResolution|null $conflict = null,
)

Parameters

$expressionScalarThe condition every row must not fail
$conflictConflictResolution|nullThe written ON CONFLICT resolution, which SQLite ignores
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): void

Derives the condition where the columns and the row identifier of the table are visible.

Parameters

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

Writes the clause.

Parameters

$outOutput
Calls 1

Test cases 5§

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 3

Relations§

Instantiated in 1