classColumnUse
final class ColumnUse
implements Scalar
uses Snapshot
@visibility public.A name used as a value: a request to resolve it as a column at its position.
The node holds the decoded name and qualifier only. Which occurrence and declaration it denotes is a fact of the operation that contains it. A name written bare, in brackets or in backticks is always this request; a word in double quotes and the bare words TRUE and FALSE are other requests.
Rule: SQLITE-COLUMN-USE-001. Facts: the resolution of SQLITE-COLUMN-LOOKUP-001 and the facts of SQLITE-COLUMN-FACT-001. Source: https://sqlite.org/lang_expr.html#column_names. Status: Implemented.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT t.a FROM t');
[$query->statement->columns[0]->expression->qualifier?->name->value, $query->statement->columns[0]->expression->name->value] // => ['t', 'a']Properties§
public Name $namepublic QualifiedName|null $qualifier = nullMethods§
public function __construct(public Name $name, public QualifiedName|null $qualifier = null)Parameters
$name | Name | The column name |
$qualifier | QualifiedName|null | The relation the use is qualified with, with its optional schema |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactResolves the name in the environment and derives its facts from the outcome.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 4
- method-call ColumnFacts::of() line 53
- new ColumnFacts line 53
- method-call ColumnResolver::find() line 53
- new ColumnResolver line 53
public function render(Output $out): voidWrites the qualifier parts and the name.
Parameters
$out | Output |
Calls 3
- method-call Output::name() line 62
- class-const NameUse::Qualifier() line 62
- class-const NameUse::Column() line 67
Test cases 53§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 51
KeyTermRuleTest::testKeyTermsWrapAStringUnderAnyParenthesesAndCollationscallsKeyTermRuleTest::testTermLeavesEveryOtherTermAsItIscallsCallRuleTest::testExpressionKeepsTheArgumentOrderingOfAnAggregatecallsCallRuleTest::testFilterLowersThePredicateOfTheFilterClausecallsExpressionRuleTest::testColumnLowersTableAndSchemaQualifiedColumnUsescallsExpressionRuleTest::testConditionalLowersTheBaseTheBranchesAndTheElsePartcallsExpressionRuleTest::testWordLowersAnUnqualifiedWordByHowItIsWrittencallsPredicateRuleTest::testExpressionLowersRangeTestscallsPredicateRuleTest::testExpressionLowersTheNullTestsByTheirSpellingcallsPredicateRuleTest::testMatchKeepsTheEscapeOperandcallsNameRuleTest::testTokenDecodesAnIdentifierTokenAndKeepsItsCasecallsSelectRuleTest::testGroupsTurnsAnIntegerConstantIntoAResultColumnPositioncallsSelectRuleTest::testSelectionLowersEveryClauseInGrammarOrdercallsDerivationTest::testScalarRecordsTheFactAndADiagnosticResolutioncallsFieldTest::testColumnReachesTheDeclarationADirectReferenceReturnscallsLeafEmbeddingTest::testDroppedAnswersTheFirstLeafTheStructureLostcallsLeafEmbeddingTest::testDroppedComparesByIdentityAndNotByValuecallsLeafEmbeddingTest::testDroppedIsNullWhenEveryLeafIsReachablecallsPublicationTest::testEstablishDerivesTheFactsAndRendersCorrespondingSqlcallsLimitsTest::testClassifyNamesEachRejectedNodecallsKeyTermsTest::testColumnIsNullForAQualifiedReferenceAndForAnExpressioncallsKeyTermsTest::testColumnReadsAPlainNameAStringAndADoubleQuotedWordcallsKeyTermsTest::testCoreLooksThroughParenthesesAndCollationscallsKeyTermsTest::testReferenceAcceptsEveryColumnReferenceAndNoOtherExpressioncallsKeyTermsTest::testStringTellsALiteralUnderTheAdmittedWrapperscallsInsertFactsTest::testDeriveBindsTheWithClauseAndReturnsTheTargetRowcallsInsertFactsTest::testDeriveLetsUpsertsSeeTheTargetAndExcludedInTheRightPlacescallsMutationScopeTest::testAssignChecksTheColumnsAndTheWidthOfEachAssignmentcallsMutationScopeTest::testReturningIsNullWithoutColumnsAndProjectsTheTargetOtherwisecallsTriggerFactsTest::testDeriveHidesTheRowThatTheEventDoesNotProvidecallsTriggerFactsTest::testDeriveMakesTheRowsOfTheEventVisibleByQualifierOnlycallsTriggerFactsTest::testDeriveReportsTriggerOnlyMisusesAndTheColumnsOfUpdateOfcallsAggregationTest::testAggregatesTellsAnAggregateByItsArgumentCountcallsOrdinalsTest::testValueIsNullForAnOrdinaryExpressioncallsResultNamesTest::testInnerLooksThroughParenthesesCollateAndTheLikelihoodFunctionscallsResultNamesTest::testRelationPrefersTheAliasThenTheWrittenWordThenTheTextcallsResultNamesTest::testWrittenAnswersTheOneWordAnExpressionConsistsOfcallsSortScopesTest::testDeriveLetsABareAliasWinOnlyWhenAskedTocallsSortScopesTest::testWordAnswersAnUnqualifiedWordOnlycallsColumnFactsTest::testDenotedAnswersTheOutcomeOfAnUngroupedNameUsecallsFromScopeTest::testEnterDerivesEveryOnConditionInTheScopeOfTheWholeChaincallsFromScopeTest::testOpenResolvesTableCallArgumentsAgainstTheTermsToTheLeftcallsCaseBranchTest::testRenderKeepsTheConditionAndTheResultInOrdercallsCaseExpressionTest::testDeriveScalarChoosesAmongTheResultTypesAndIsNotNullWithElsecallsCastTest::testDeriveScalarReadsTheTypeNameAndItsArgumentscallsCollateTest::testDeriveScalarKeepsTheTypeAndNullFactAndLeavesTheResolutionToTheOperandcallsGroupedTest::testDeriveScalarKeepsTheTypeAndNullFactAndLeavesTheResolutionToTheOperandcallsRowExpressionTest::testDeriveScalarGivesARowOfTheWrittenWidthcallsSortTermTest::testRenderWritesANewlyBuiltTermcallsResultColumnTest::testRenderWritesTheAliasWithAsWhenItWasWrittencallsSelectTest::testRenderWritesANewlyBuiltSelectioncalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::word() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:105
- new SqlSemantics\Platform\Sqlite\Lowering\Expression\ExpressionRule::column() packages/sql-semantics-sqlite/src/Lowering/Expression/ExpressionRule.php:119
Type checks 14
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Expression\Limits::classify() packages/sql-semantics-sqlite/src/Rules/Definition/Expression/Limits.php:123
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Expression\Limits::nonConstant() packages/sql-semantics-sqlite/src/Rules/Definition/Expression/Limits.php:165
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\KeyTerms::column() packages/sql-semantics-sqlite/src/Rules/Definition/KeyTerms.php:79
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\KeyTerms::reference() packages/sql-semantics-sqlite/src/Rules/Definition/KeyTerms.php:96
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ColumnTyping::text() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ColumnTyping.php:96
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::of() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:91
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ValueKinds::of() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ValueKinds.php:103
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::spelled() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:167
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\ResultNames::output() packages/sql-semantics-sqlite/src/Rules/Query/ResultNames.php:90
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\ResultNames::resolved() packages/sql-semantics-sqlite/src/Rules/Query/ResultNames.php:136
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\ResultNames::written() packages/sql-semantics-sqlite/src/Rules/Query/ResultNames.php:151
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\ResultNames::declared() packages/sql-semantics-sqlite/src/Rules/Query/ResultNames.php:183
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\SortScopes::word() packages/sql-semantics-sqlite/src/Rules/Query/SortScopes.php:76
- instanceof SqlSemantics\Platform\Sqlite\Rules\Resolution\ColumnFacts::denoted() packages/sql-semantics-sqlite/src/Rules/Resolution/ColumnFacts.php:72