classColumnCheck
final class ColumnCheck
implements ColumnConstraint
uses Snapshot
Public API: explicitly declared with
@visibility public.A CHECK column constraint.
Rule: SQLITE-COLUMN-CHECK-001. The expression is evaluated for each written row and may refer to any column of the table and to its row identifier, not only to the column it is written after. It is derived at a position whose only visible relation is the table being defined. A bound parameter or a subquery in it 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 INT CHECK (a > 0))');
$check = $create->statement->columns[0]->constraints[0];
$create->facts->scalar($check->expression->left)->resolution->slot->column === $create->declarations()[0]->columns[0] // => trueProperties§
public Scalar $expressionMethods§
public function __construct(public Scalar $expression)Parameters
$expression | Scalar | The condition every row must not fail |
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 48
- method-call Limits::report() line 49
- new Limits line 49
- class-const DefinitionPosition::CheckConstraint() line 49
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.