classConstraintName
final class ConstraintName
implements ColumnConstraint, TableConstraint
uses Snapshot
@visibility public.A CONSTRAINT name clause.
Rule: SQLITE-CONSTRAINT-NAME-001. In the grammar the clause is an element of the constraint list of its own, not a part of the constraint after it: it may be repeated and it may be the last element. SQLite remembers the most recent name and uses it only to name the CHECK constraints that follow in the error they raise. The remembered name is forgotten at the start of the next column definition and at a comma between table constraints, so the model keeps the clause at its written place. Source: https://sqlite.org/syntax/column-constraint.html, https://sqlite.org/syntax/table-constraint.html. Status: Implemented.
$create = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('CREATE TABLE t (a CONSTRAINT positive CHECK (a > 0))');
$create->statement->columns[0]->constraints[0]->name->value // => 'positive'Properties§
public Name $nameMethods§
public function deriveConstraint(Derivation $derivation, ConstraintScope $scope): voidDerives nothing: the clause has no operand that depends on a declaration.
Parameters
$derivation | Derivation | |
$scope | ConstraintScope |
public function render(Output $out): voidWrites the clause.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 56
- class-const NameUse::Label() line 56
Test cases 6§
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 4
Relations§
Instantiated in 2
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\ColumnRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/ColumnRule.php:102
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:96