classTableConstraintRule
final class TableConstraintRule
Lowers the table constraints and the table options of a table definition.
Rule: SQLITE-TABLE-CONSTRAINT-LOWER-001. Scope: conslist_opt, conslist, tconscomma, tcons, table_option_set, table_option. Constructors: ConstraintRun, ConstraintName, TablePrimaryKey, TableUnique, TableCheck, ForeignKey, TableOption. A written comma between two constraints ends a run; a missing one continues it, so the place of every comma is kept, as is a comma the grammar admits before the first table option. A string literal among the key terms is lowered by SQLITE-KEY-TERM-LOWER-001. Terminates: both lists are flattened iteratively. Source: https://sqlite.org/syntax/table-constraint.html, https://sqlite.org/syntax/table-options.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
Calls 3
- new ForeignKeyRule line 51
- new ColumnRule line 52
- new WordRule line 53
public function runs(Node $list): list<ConstraintRun>Lowers the optional constraint list into comma-separated runs.
Parameters
$list | Node |
Returns
list<ConstraintRun>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 5
- static-call ImplementationGap::production() line 68
- method-call Lists::items() line 74
- new Lists line 74
- new ConstraintRun line 77
- method-call TableConstraintRule::constraint() line 80
public function constraint(Form $form): TableConstraintLowers one table constraint.
Parameters
$form | Form |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 12
- new ConstraintName line 96
- method-call Form::node() line 96
- new TablePrimaryKey line 97
- method-call KeyTermRule::keyTerms() line 98
- new KeyTermRule line 98
- method-call ColumnRule::autoincrement() line 100
- new TableUnique line 102
- new TableCheck line 103
- new ForeignKey line 104
- method-call ForeignKeyRule::clause() line 106
- method-call ForeignKeyRule::optionalDeferrability() line 107
- static-call ImplementationGap::production() line 109
public function options(Node $set): list<TableOption>Lowers the table options in written order.
Parameters
$set | Node |
Returns
list<TableOption>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 5
- function-call
in_arrayline 122 - static-call ImplementationGap::production() line 123
- method-call Lists::elements() line 126
- new Lists line 126
- method-call TableConstraintRule::option() line 128
public function leadingComma(Node $set): boolTells whether a comma is written before the first table option, which the grammar admits after an empty option set.
Parameters
$set | Node |
Returns
boolThrows
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- function-call
in_arrayline 143 - static-call ImplementationGap::production() line 144
- method-call Lists::elements() line 146
- new Lists line 146
public function option(Node $option): TableOptionLowers one table option.
Parameters
$option | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 3
- new TableOption line 161
- method-call WordRule::name() line 161
- static-call ImplementationGap::production() line 163
Private surface 4§
Implementation details, listed for orientation only.
private ForeignKeyRule $foreignKeysprivate ColumnRule $columnsprivate WordRule $wordsprivate Lowering $loweringTest cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TableConstraintRuleTestcalls
Relations§
Instantiated in 1
Method calls 3
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\CreateTableRule::command() packages/sql-semantics-sqlite/src/Lowering/Definition/CreateTableRule.php:67
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\CreateTableRule::command() packages/sql-semantics-sqlite/src/Lowering/Definition/CreateTableRule.php:68
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\CreateTableRule::command() packages/sql-semantics-sqlite/src/Lowering/Definition/CreateTableRule.php:71