classTableCheck
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.
$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 $expressionpublic ConflictResolution|null $conflict = nullMethods§
public function __construct(
public Scalar $expression,
public ConflictResolution|null $conflict = null,
)Parameters
$expression | Scalar | The condition every row must not fail |
$conflict | ConflictResolution|null | The written ON CONFLICT resolution, which SQLite ignores |
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): voidDerives the condition where the columns and the row identifier of the table are visible.
Parameters
$derivation | Derivation | |
$scope | ConstraintScope |
Calls 4
- method-call Derivation::scalar() line 51
- method-call Limits::report() line 52
- new Limits line 52
- class-const DefinitionPosition::CheckConstraint() line 52
public function render(Output $out): voidTest cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.