classInsertFacts
final class InsertFacts
Derives the facts of an INSERT statement.
Rule: SQLITE-INSERT-001. The source query is derived where the common tables of the statement are visible; it does not see the written table. The source must supply one value per column of the column list, or per column of the table that is not generated when no list is written; another count is reported when both counts are known. Writes of generated columns follow SQLITE-GENERATED-WRITE-001. In an ON CONFLICT clause the conflict target sees the written table; DO UPDATE sees the written table and, under the qualifier excluded, the row that could not be inserted. An ON CONFLICT clause on a view is reported (SQLITE-RELATION-KIND-001). RETURNING follows SQLITE-MUTATION-SCOPE-001. Source: https://sqlite.org/lang_insert.html, https://sqlite.org/lang_upsert.html. Status: Implemented.
Methods§
public function derive(
InsertInto $into,
Query|null $source,
list<Upsert> $upserts,
list<ResultColumn|Star|TableStar> $returning,
Derivation $derivation,
Environment $outer,
): ?QueryFactDerives every part of an INSERT and answers the rows it returns, or null when it returns none.
Parameters
$into | InsertInto | |
$source | Query|null | The query that supplies the rows; null for DEFAULT VALUES |
$upserts | list<Upsert> | |
$returning | list<ResultColumn|Star|TableStar> | |
$derivation | Derivation | |
$outer | Environment |
Returns
Test cases 4
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertDefaults::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertDefaults.php:69
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertRows::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertRows.php:82
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertSelect::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertSelect.php:88
Calls 24
- new MutationScope line 54
- method-call MutationScope::open() line 55
- method-call RelationKinds::refuse() line 57
- new RelationKinds line 57
- class-const KindRefusal::Upsert() line 57
- method-call MutationScope::names() line 59
- new GeneratedWrites line 60
- method-call GeneratedWrites::inserted() line 61
- method-call Derivation::query() line 63
- function-call
countline 64 - method-call GeneratedWrites::writable() line 64
- method-call Derivation::report() line 66
- new ArityMismatch line 66
- class-const ArityRule::InsertedValues() line 66
- new VisibleRelation line 69
- new Name line 69
- class-const ColumnResolver::QUALIFIED_ONLY() line 69
- new Environment line 70
- method-call GeneratedWrites::supplied() line 72
- method-call Derivation::scalar() line 75
- method-call MutationScope::assign() line 81
- method-call GeneratedWrites::reached() line 82
- method-call GeneratedWrites::assigned() line 83
- method-call MutationScope::returning() line 90
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
Relations§
Instantiated in 3
- new SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertDefaults::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertDefaults.php:69
- new SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertRows::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertRows.php:82
- new SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertSelect::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertSelect.php:88
Method calls 3
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertDefaults::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertDefaults.php:69
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertRows::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertRows.php:82
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertSelect::deriveWithin() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertSelect.php:88