classTableShapes
final class TableShapes
Derives the row shape of one use of a named relation.
Rule: SQLITE-TABLE-SHAPE-001. An unqualified name denotes the nearest common table of that name, then a declared relation found along the schema search path. A declared relation contributes one slot per declared column, in order, each referring to the declaration, and is open when its column list is incomplete; a common table contributes the slots it was bound with; an undeclared or conditionally resolved name contributes an open shape that names the missing declaration; a missing or conflicting name contributes an empty shape and is a diagnostic. The implicit columns of a declared table (rowid and its aliases) are reachable by name only. Source: https://sqlite.org/lang_naming.html, https://sqlite.org/lang_with.html, https://sqlite.org/rowidtable.html. Status: Implemented.
Methods§
public function fact(
Derivation $derivation,
QualifiedName $name,
Environment $environment,
): RelationFactResolves a relation name at a position and derives the shape of the use.
Parameters
$derivation | Derivation | |
$name | QualifiedName | |
$environment | Environment |
Returns
Test cases 20
ColumnFactsTest::testDenotedAnswersTheOutcomeOfAnUngroupedNameUsecallsColumnResolverTest::testFindIsConditionalWhenAnOpenRelationMayHoldTheNamecallsColumnResolverTest::testFindPrefersARelationColumnOverAnAliasAndAnAliasOverOuterScopescallsColumnResolverTest::testFindReportsAmbiguityAndHonoursHiddenAndQualifiedOnlyRelationscallsColumnResolverTest::testFindResolvesUnqualifiedQualifiedAndImplicitNamescallsColumnResolverTest::testMatchFindsSlotsOrImplicitNamesAndOtherwiseAnswersTheMissingInputscallsFromScopeTest::testStarListsTheUnhiddenSlotsOfQualifiableRelationsOnlycallsJoiningTest::testClosedIsTrueOnlyForCompleteFullyNamedShapescallsJoiningTest::testExtendMakesEverySlotAndImplicitNullableAndKeepsOriginscallsJoiningTest::testJoinCoalescesTheMergedColumnAndExtendsTheLeftSideOfARightJoincallsJoiningTest::testJoinExtendsTheRightSideOfALeftJoincallsJoiningTest::testJoinHidesTheRightUsingColumnAndKeepsTheLeftSidecallsJoiningTest::testJoinMergesEveryCommonNameOfANaturalJoincallsJoiningTest::testJoinReportsAUsingColumnThatAClosedSideLackscallsJoiningTest::testLocateFindsTheFirstVisibleSlotByNamecallsTableShapesTest::testFactAnswersAnOpenShapeForAnUndeclaredTableAndAnEmptyOneForAMissingTablecallsTableShapesTest::testFactAnswersTheDeclaredShapeWithItsColumnscallsTableShapesTest::testFactCopiesTheShapeOfACommonTableAndLinksItsSlotscallsTableShapesTest::testFactMarksAnIncompleteDeclarationAsOpencallsTableShapesTest::testImplicitListsTheRowIdentifierOfADeclaredTableOnlycalls
Called from 5
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Subquery\InTable::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Subquery/InTable.php:83
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\MutationTarget::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Mutation/MutationTarget.php:69
- method-call SqlSemantics\Platform\Sqlite\Statement\Relation\TableCall::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Relation/TableCall.php:72
- method-call SqlSemantics\Platform\Sqlite\Statement\Relation\TableInput::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Relation/TableInput.php:70
- method-call SqlSemantics\Platform\Sqlite\Statement\Trigger\TriggerTable::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Trigger/TriggerTable.php:62
Calls 7
- method-call Derivation::table() line 45
- new OutputSlot line 49
- new Known line 49
- new RelationFact line 52
- new RowShape line 52
- new IncompleteMembers line 52
- method-call Environment::commonTable() line 56
public function implicit(RelationFact $fact): list<ImplicitSlot>Answers the implicit columns of the relation a use resolved to.
Parameters
$fact | RelationFact |
Returns
list<ImplicitSlot>Test cases 5
ColumnResolverTest::testFindResolvesUnqualifiedQualifiedAndImplicitNamescallsColumnResolverTest::testMatchFindsSlotsOrImplicitNamesAndOtherwiseAnswersTheMissingInputscallsJoiningTest::testExtendMakesEverySlotAndImplicitNullableAndKeepsOriginscallsJoiningTest::testJoinExtendsTheRightSideOfALeftJoincallsTableShapesTest::testImplicitListsTheRowIdentifierOfADeclaredTableOnlycalls
Called from 3
- method-call SqlSemantics\Platform\Sqlite\Rules\Mutation\MutationScope::open() packages/sql-semantics-sqlite/src/Rules/Mutation/MutationScope.php:58
- method-call SqlSemantics\Platform\Sqlite\Rules\Mutation\TriggerFacts::derive() packages/sql-semantics-sqlite/src/Rules/Mutation/TriggerFacts.php:57
- method-call SqlSemantics\Platform\Sqlite\Rules\Resolution\FromScope::open() packages/sql-semantics-sqlite/src/Rules/Resolution/FromScope.php:63
Calls 3
- new ImplicitSlot line 78
- new OutputSlot line 78
- new Known line 78
Test cases 20§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
TableShapesTest::testFactAnswersAnOpenShapeForAnUndeclaredTableAndAnEmptyOneForAMissingTablecallsTableShapesTest::testFactAnswersTheDeclaredShapeWithItsColumnscallsTableShapesTest::testFactCopiesTheShapeOfACommonTableAndLinksItsSlotscallsTableShapesTest::testFactMarksAnIncompleteDeclarationAsOpencallsTableShapesTest::testImplicitListsTheRowIdentifierOfADeclaredTableOnlycalls
Other tests reaching this symbol 15
ColumnFactsTest::testDenotedAnswersTheOutcomeOfAnUngroupedNameUsecallsColumnResolverTest::testFindIsConditionalWhenAnOpenRelationMayHoldTheNamecallsColumnResolverTest::testFindPrefersARelationColumnOverAnAliasAndAnAliasOverOuterScopescallsColumnResolverTest::testFindReportsAmbiguityAndHonoursHiddenAndQualifiedOnlyRelationscallsColumnResolverTest::testFindResolvesUnqualifiedQualifiedAndImplicitNamescallsColumnResolverTest::testMatchFindsSlotsOrImplicitNamesAndOtherwiseAnswersTheMissingInputscallsFromScopeTest::testStarListsTheUnhiddenSlotsOfQualifiableRelationsOnlycallsJoiningTest::testClosedIsTrueOnlyForCompleteFullyNamedShapescallsJoiningTest::testExtendMakesEverySlotAndImplicitNullableAndKeepsOriginscallsJoiningTest::testJoinCoalescesTheMergedColumnAndExtendsTheLeftSideOfARightJoincallsJoiningTest::testJoinExtendsTheRightSideOfALeftJoincallsJoiningTest::testJoinHidesTheRightUsingColumnAndKeepsTheLeftSidecallsJoiningTest::testJoinMergesEveryCommonNameOfANaturalJoincallsJoiningTest::testJoinReportsAUsingColumnThatAClosedSideLackscallsJoiningTest::testLocateFindsTheFirstVisibleSlotByNamecalls
Relations§
Instantiated in 8
- new SqlSemantics\Platform\Sqlite\Rules\Mutation\MutationScope::open() packages/sql-semantics-sqlite/src/Rules/Mutation/MutationScope.php:58
- new SqlSemantics\Platform\Sqlite\Rules\Mutation\TriggerFacts::derive() packages/sql-semantics-sqlite/src/Rules/Mutation/TriggerFacts.php:57
- new SqlSemantics\Platform\Sqlite\Rules\Resolution\FromScope::open() packages/sql-semantics-sqlite/src/Rules/Resolution/FromScope.php:63
- new SqlSemantics\Platform\Sqlite\Statement\Expression\Subquery\InTable::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Subquery/InTable.php:83
- new SqlSemantics\Platform\Sqlite\Statement\Mutation\MutationTarget::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Mutation/MutationTarget.php:69
- new SqlSemantics\Platform\Sqlite\Statement\Relation\TableCall::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Relation/TableCall.php:72
- new SqlSemantics\Platform\Sqlite\Statement\Relation\TableInput::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Relation/TableInput.php:70
- new SqlSemantics\Platform\Sqlite\Statement\Trigger\TriggerTable::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Trigger/TriggerTable.php:62
Method calls 8
- method-call SqlSemantics\Platform\Sqlite\Rules\Mutation\MutationScope::open() packages/sql-semantics-sqlite/src/Rules/Mutation/MutationScope.php:58
- method-call SqlSemantics\Platform\Sqlite\Rules\Mutation\TriggerFacts::derive() packages/sql-semantics-sqlite/src/Rules/Mutation/TriggerFacts.php:57
- method-call SqlSemantics\Platform\Sqlite\Rules\Resolution\FromScope::open() packages/sql-semantics-sqlite/src/Rules/Resolution/FromScope.php:63
- method-call SqlSemantics\Platform\Sqlite\Statement\Expression\Subquery\InTable::deriveScalar() packages/sql-semantics-sqlite/src/Statement/Expression/Subquery/InTable.php:83
- method-call SqlSemantics\Platform\Sqlite\Statement\Mutation\MutationTarget::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Mutation/MutationTarget.php:69
- method-call SqlSemantics\Platform\Sqlite\Statement\Relation\TableCall::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Relation/TableCall.php:72
- method-call SqlSemantics\Platform\Sqlite\Statement\Relation\TableInput::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Relation/TableInput.php:70
- method-call SqlSemantics\Platform\Sqlite\Statement\Trigger\TriggerTable::deriveRelation() packages/sql-semantics-sqlite/src/Statement/Trigger/TriggerTable.php:62