classConstraintRun
final class ConstraintRun
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The table constraints written one after another without a comma between them.
Rule: SQLITE-CONSTRAINT-RUN-001. The comma between table constraints is optional, but it is not without meaning: a CONSTRAINT name clause stays in effect for the constraints that follow it until the next comma. A table definition therefore holds its table constraints as comma-separated runs, and a constraint name belongs to its run. Source: https://sqlite.org/syntax/create-table-stmt.html (grammar tconscomma). Status: Implemented.
$semantics = new \SqlSemantics\Platform\Sqlite\Semantics();
$named = $semantics->analyze('CREATE TABLE t (a, CONSTRAINT c CHECK (a > 0))');
$cut = $semantics->analyze('CREATE TABLE t (a, CONSTRAINT c, CHECK (a > 0))');
[count($named->statement->constraints), count($cut->statement->constraints)] // => [1, 2]Properties§
public non-empty-list<TableConstraint> $itemsMethods§
public function __construct(list<TableConstraint> $items)Parameters
$items | list<TableConstraint> | The constraints of the run in written order; at least one |
Calls 2
- static-call Check::listOf() line 44
- class-const TableConstraint::class() line 44
public function render(Output $out): voidWrites the constraints without a comma between them.
Parameters
$out | Output |
Calls 1
- method-call Output::node() line 53
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ConstraintRunTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::runs() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:77
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::runs() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:83