classForeignKeyRule
final class ForeignKeyRule
Lowers the clauses of a foreign key.
Rule: SQLITE-FOREIGN-KEY-LOWER-001. Scope: refargs, refarg, refact, defer_subclause, defer_subclause_opt, init_deferred_pred_opt, and the REFERENCES part shared by the column and the table constraint. Constructors: ForeignKeyClause, MatchName, ReferenceAction, Deferrability. The actions and MATCH names keep their written order; every keyword is a model value. Terminates: the argument list is flattened iteratively. Source: https://sqlite.org/syntax/foreign-key-clause.html. Status: Implemented.
Methods§
public function __construct(private Lowering $lowering)Parameters
$lowering | Lowering | The lowering this rule belongs to |
public function clause(Node $table, Node $columns, Node $arguments): ForeignKeyClauseLowers the parent table, its optional column list and the clauses after it.
Returns
Called from 2
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\ColumnRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/ColumnRule.php:112
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:106
Calls 2
- new ForeignKeyClause line 70
- method-call ForeignKeyRule::arguments() line 70
public function arguments(Node $list): list<ReferenceArgument>Lowers the actions and MATCH names in written order.
Parameters
$list | Node |
Returns
list<ReferenceArgument>Throws
ImplementationGap When a production has no ruleCalled from 1
Calls 4
- static-call ImplementationGap::production() line 83
- method-call Lists::items() line 86
- new Lists line 86
- method-call ForeignKeyRule::argument() line 87
public function argument(Node $argument): ReferenceArgumentLowers one action or MATCH name.
Parameters
$argument | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 5
- new MatchName line 102
- new ReferenceAction line 106
- class-const ForeignKeyRule::EVENTS() line 107
- static-call ImplementationGap::production() line 107
- class-const ForeignKeyRule::REACTIONS() line 108
public function deferrability(Node $clause): DeferrabilityLowers a DEFERRABLE or NOT DEFERRABLE clause.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\ColumnRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/ColumnRule.php:113
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\ForeignKeyRule::optionalDeferrability() packages/sql-semantics-sqlite/src/Lowering/Definition/ForeignKeyRule.php:139
Calls 3
- new Deferrability line 122
- method-call ForeignKeyRule::initially() line 122
- static-call ImplementationGap::production() line 124
public function optionalDeferrability(Node $clause): ?DeferrabilityLowers the optional DEFERRABLE clause of a table constraint.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 1
Calls 2
- method-call ForeignKeyRule::deferrability() line 139
- static-call ImplementationGap::production() line 140
public function initially(Node $clause): ?InitialModeLowers the optional INITIALLY clause.
Parameters
$clause | Node |
Returns
Throws
ImplementationGap When the production has no ruleCalled from 2
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\ForeignKeyRule::deferrability() packages/sql-semantics-sqlite/src/Lowering/Definition/ForeignKeyRule.php:122
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\ForeignKeyRule::deferrability() packages/sql-semantics-sqlite/src/Lowering/Definition/ForeignKeyRule.php:123
Calls 3
- class-const InitialMode::Deferred() line 155
- class-const InitialMode::Immediate() line 156
- static-call ImplementationGap::production() line 157
Private surface 3§
Implementation details, listed for orientation only.
private const EVENTS = ['refarg: ON INSERT refact' => \SqlSemantics\Platform\Sqlite\Statement\Schema\R…private const REACTIONS = ['refact: SET NULL' => \SqlSemantics\Platform\Sqlite\Statement\Schema\Reference…private 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
ForeignKeyRuleTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\ColumnRule::__construct() packages/sql-semantics-sqlite/src/Lowering/Definition/ColumnRule.php:53
- new SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::__construct() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:51
Method calls 4
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\ColumnRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/ColumnRule.php:112
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\ColumnRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/ColumnRule.php:113
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:106
- method-call SqlSemantics\Platform\Sqlite\Lowering\Definition\TableConstraintRule::constraint() packages/sql-semantics-sqlite/src/Lowering/Definition/TableConstraintRule.php:107