classTable
final class Table
uses Snapshot
Public API: explicitly declared with
@visibility public.A relation declaration supplied to an analysis context: a table or a view with its columns.
The object is the identity of the declaration. Two equal-looking tables are two declarations, and a context that holds both keeps the conflict.
$semantics = new \SqlSemantics\Platform\MySql\Semantics();
$table = $semantics->analyze('CREATE TABLE users (id INTEGER, name TEXT)')->declarations()[0];
[$table->name->name->value, count($table->columns)] // => ['users', 2]Properties§
public list<Column> $columnspublic list<ImplicitColumn> $implicitpublic QualifiedName $namepublic LanguageProfile $profilepublic bool $complete = truepublic RelationKind $kind = RelationKind::BaseTableMethods§
public function __construct(
public QualifiedName $name,
public LanguageProfile $profile,
list<Column> $columns,
list<ImplicitColumn> $implicit = [],
public bool $complete = true,
public RelationKind $kind = RelationKind::BaseTable,
)Parameters
$name | QualifiedName | The declared name |
$profile | LanguageProfile | The language profile the declaration was read under |
$columns | list<Column> | The declared columns in declaration order |
$implicit | list<ImplicitColumn> | The columns found by name without being declared |
$complete | bool | Whether the column list is the complete member list of the relation |
$kind | RelationKind | Whether the relation is a base table, a view, or another kind of relation |
Calls 4
- class-const RelationKind::BaseTable() line 53
- static-call Check::listOf() line 55
- class-const Column::class() line 55
- class-const ImplicitColumn::class() line 56
public function matchingColumns(string $name, Comparison $comparison): list<Column>Finds the declared columns a name denotes, falling back to the implicit columns.
More than one result means the declaration itself repeats the name.
Parameters
$name | string | |
$comparison | Comparison |
Returns
list<Column>Called from 1
Calls 1
- method-call Comparison::equal() line 70
Test cases 97§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Other tests reaching this symbol 97
ColumnResolverTest::testFindFallsBackToTheAliasOfASelectListItemcallsColumnResolverTest::testFindIgnoresAliasesForAQualifiedNamecallsColumnResolverTest::testFindIsConditionalWhileAnItemWithoutADecidedNameCouldHaveTheNamecallsColumnResolverTest::testFindPrefersAColumnOfTheFromClauseToAnAliascallsColumnResolverTest::testFindReportsAnAliasOfSeveralDifferentItemscallsChangeFactsTest::testClausesDeriveLimitWithoutTablescallsChangeFactsTest::testDeleteMultipleChecksTheTargetscallsChangeFactsTest::testDeleteSeesTheTablecallsChangeFactsTest::testReferencesLetLaterTablesSeeEarlierOnescallsChangeFactsTest::testUpdatableRefusesDerivedAndCommonTablescallsChangeFactsTest::testUpdateSeesEveryTablecallsInsertFactsTest::testColumnIsInvalidBeyondTheWrittenColumnscallsInsertFactsTest::testDuplicatesReportsAnAliasThatIsTheTableNamecallsInsertFactsTest::testQueryDerivesTheSourceWithoutTheTablecallsInsertFactsTest::testSetDerivesTheAssignmentscallsLoadFactsTest::testDeriveReportsAnUnknownColumncallsSourceRelationsTest::testMembersAnswersTheJoinedRelationscallsSourceRelationsTest::testVisibleOffersNothingForAGroupedSourcecallsWriteScopeTest::testAssignAnswersTheAssignedColumnscallsWriteScopeTest::testDistinctReportsAColumnWrittenTwicecallsWriteScopeTest::testFieldTakesTheColumnFactcallsWriteScopeTest::testValueDerivesDefaultAsTheColumncallsFromScopeTest::testEnterDerivesTheConditionWithTheOperandsBeforeExtensioncallsFromScopeTest::testOpenMakesATableVisibleUnderItsCorrelationNamecallsJoiningTest::testJoinMergesTheUsingColumnscallsJoiningTest::testLocateLeavesAUsingColumnAnUnnamedColumnMayBecallsJoiningTest::testLocateReportsAColumnSelectedTwicecallsProjectionTest::testItemsDerivesExpressionsAndStarscallsProjectionTest::testQualifiedReportsAnUnknownTablecallsSelectFactsTest::testDeriveScopesEveryClausecallsSortScopesTest::testDeriveResolvesOrdinalsAliasesAndColumnscallsTableShapesTest::testExplicitAnswersEveryColumncallsTableShapesTest::testImplicitFindsInvisibleColumnsByNameOnlycallsTableShapesTest::testNamedPrefersACommonTablecallsRelationKindsTest::testKindAnswersTheKindOfADeclarationMySqlHascallsRelationKindsTest::testRefuseViewReportsADeclaredViewcallsRelationKindsTest::testRequireReportsADeclarationOfTheOtherKindcallsDefaultRequestTest::testDeriveScalarTakesTheAssignedColumncallsDeleteTest::testDeriveStatementSeesTheTableUnderItsAliascallsHandlerOpenTest::testDeriveStatementResolvesTheTablecallsInsertQueryTest::testDeriveStatementComparesTheQueryWidthcallsInsertQueryTest::testDeriveStatementLetsUpdatesSeeTheSourceTablescallsInsertRowsTest::testDeriveStatementAcceptsAnEmptyRowWithoutColumnscallsInsertRowsTest::testDeriveStatementChecksTheRowscallsInsertSetTest::testDeriveStatementReportsAColumnAssignedTwicecallsRowAliasTest::testDeriveRelationNamesTheWrittenColumnscallsRowAliasTest::testDeriveRelationReportsAnotherColumnCountcallsLoadTableTest::testDeriveStatementResolvesColumnsAndAssignmentscallsMultipleDeleteTest::testDeriveStatementMatchesCorrelationNamescallsMultipleDeleteTest::testDeriveStatementReportsATableOutsideTheReferencescallsUpdateTest::testDeriveStatementReportsOrderAndLimitOfAMultipleTableUpdatecallsUpdateTest::testDeriveStatementResolvesAssignmentsAgainstEveryTablecallsWriteTargetTest::testDeriveRelationResolvesTheTablecallsComparisonTest::testDeriveScalarNeverYieldsNullForTheNullSafeEqualitycallsComparisonTest::testDeriveScalarNeverYieldsNullWhenBothOperandsCannotcallsComparisonTest::testDeriveScalarYieldsAnIntegerThatCanBeNullWhenAnOperandCancallsColumnUseTest::testDeriveScalarAnswersTheFactsOfTheItemAnAliasNamescallsColumnUseTest::testDeriveScalarAnswersTheTypeAndNullFactOfTheResolvedSlotcallsColumnUseTest::testDeriveScalarReportsAMissingColumncallsColumnUseTest::testDeriveScalarReportsAnAmbiguousColumncallsColumnUseTest::testDeriveScalarResolvesWithoutRegardToLetterCasecallsLateOrderingTest::testRenderWritesTheOrderingAfterTheLockingClausesOfTheBlockcallsOutputOrdinalTest::testDeriveScalarTakesTheFactsOfTheFieldcallsExplicitTableTest::testDeriveQueryAnswersEveryColumnOfTheTablecallsExplicitTableTest::testDeriveStatementRecordsTheColumnsAsTheOutputcallsParenthesizedQueryTest::testDeriveQueryAnswersTheFactsOfTheInnerQuerycallsParenthesizedQueryTest::testDeriveStatementRecordsTheRowsOfTheInnerQuerycallsQueryExpressionTest::testDeriveStatementRecordsTheRowsOfTheBodycallsSelectTest::testDeriveQueryDerivesThePredicateInTheScopeOfTheTablecallsSelectTest::testDeriveQueryExpandsStarsOverJoinscallsSelectTest::testDeriveQueryExtendsColumnsWithNullsInAnAggregateBlockcallsSelectTest::testDeriveQueryKeepsDuplicateOutputNamescallsSelectTest::testDeriveQueryNamesTheFieldsAfterAliasesAndColumnscallsSelectTest::testDeriveQueryReportsAColumnWithAWrongQualifiercallsSelectTest::testDeriveQueryResolvesAQualifiedColumnAgainstTheTableOccurrencecallsSelectTest::testDeriveStatementRecordsTheRowsAsTheOutputcallsSelectTest::testRenderBuildsSqlFromAnExplicitStructurecallsSelectTest::testRenderReadsADoubleQuotedNameUnderAnsiQuotescallsSetOperationTest::testDeriveQueryNamesTheColumnsAfterTheFirstOperandAndCombinesNullabilitycallsSetOperationTest::testDeriveStatementRecordsTheRowsAsTheOutputcallsDerivedTableTest::testDeriveRelationNamesTheColumnsAfterTheQueryOrTheListcallsDerivedTableTest::testDeriveRelationSeesTheTablesToTheLeftWhenLateralcallsJoinedTableTest::testDeriveRelationMergesTheCommonColumnsOfANaturalJoincallsJoinedTableTest::testDeriveRelationMergesUsingColumnsAndExtendsTheOuterSidecallsJoinedTableTest::testDeriveRelationNestsLikeTheParseOfTheReleasecallsJoinedTableTest::testDeriveRelationReportsAUsingColumnAnOperandLackscallsNestedRelationTest::testDeriveRelationKeepsTheInnerTablesVisiblecallsOdbcJoinTest::testDeriveRelationDerivesTheEscapedReferencecallsTableListTest::testDeriveRelationJoinsTheMembersLeftToRightcallsTableListTest::testDeriveRelationKeepsTheJoinConditionToItsOperandscallsTableReferenceTest::testDeriveRelationDoesNotFindATableOfAnotherDatabasecallsTableReferenceTest::testDeriveRelationExposesOneSlotPerDeclaredColumncallsTableReferenceTest::testDeriveRelationReportsConflictingDeclarationscallsTableReferenceTest::testDeriveRelationResolvesAnUnqualifiedNameInTheCurrentDatabasecallsTriggerTableTest::testDeriveRelationAnswersTheRowOfTheDeclaredTablecallsTriggerTableTest::testDeriveRelationDoesNotFindATableOfAnotherDatabasecallsVariableAssignmentTest::testDeriveScalarHasTheFactsOfTheValuecalls
Relations§
Instantiated in 4
- new SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration::split() packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:157
- new SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration::view() packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:180
- new SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration::like() packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:189
- new SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration::like() packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:200
Method calls 1
Constant reads 4
- class-const SqlSemantics\Platform\MySql\Model\Contract\AnalysisContext::__construct() packages/sql-semantics-mysql/src/Model/Contract/AnalysisContext.php:68
- class-const SqlSemantics\Platform\MySql\Model\Statement\Fact\Facts::__construct() packages/sql-semantics-mysql/src/Model/Statement/Fact/Facts.php:67
- class-const SqlSemantics\Platform\MySql\Model\Statement\Reference\Table\ConditionalTable::__construct() packages/sql-semantics-mysql/src/Model/Statement/Reference/Table/ConditionalTable.php:41
- class-const SqlSemantics\Platform\MySql\Model\Statement\Reference\Table\ConflictingTables::__construct() packages/sql-semantics-mysql/src/Model/Statement/Reference/Table/ConflictingTables.php:37
Type declarations 17
- type SqlSemantics\Platform\MySql\Model\Construction\Derivation packages/sql-semantics-mysql/src/Model/Construction/Derivation.php:229
- type SqlSemantics\Platform\MySql\Model\Statement\Reference\Missing\IncompleteMembers packages/sql-semantics-mysql/src/Model/Statement/Reference/Missing/IncompleteMembers.php:26
- type SqlSemantics\Platform\MySql\Model\Statement\Reference\Table\DeclaredTable packages/sql-semantics-mysql/src/Model/Statement/Reference/Table/DeclaredTable.php:27
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\ElementFacts packages/sql-semantics-mysql/src/Rules/TableDefinition/ElementFacts.php:45
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:103
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:144
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:166
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:186
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableProblems packages/sql-semantics-mysql/src/Rules/TableDefinition/TableProblems.php:54
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableProblems packages/sql-semantics-mysql/src/Rules/TableDefinition/TableProblems.php:86
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableProblems packages/sql-semantics-mysql/src/Rules/TableDefinition/TableProblems.php:99
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableProblems packages/sql-semantics-mysql/src/Rules/TableDefinition/TableProblems.php:134
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableTargets packages/sql-semantics-mysql/src/Rules/TableDefinition/TableTargets.php:51
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableTargets packages/sql-semantics-mysql/src/Rules/TableDefinition/TableTargets.php:66
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableTargets packages/sql-semantics-mysql/src/Rules/TableDefinition/TableTargets.php:98
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\ViewFacts packages/sql-semantics-mysql/src/Rules/TableDefinition/ViewFacts.php:33
- type SqlSemantics\Platform\MySql\Statement\Table\Key\References packages/sql-semantics-mysql/src/Statement/Table/Key/References.php:71