classQueryFact
final class QueryFact
uses Snapshot
Public API: explicitly declared with
@visibility public.What an operation derived for the output of one query.
The projection lists the output fields in order. A star that missing declarations prevent from expanding stays a typed request and leaves the shape open; no field is invented for it.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT 1 AS a, 2 AS b');
[count($query->facts->output->projection), $query->facts->output->shape->complete()] // => [2, true]Properties§
public RowShape $shapepublic Comparison $namesMethods§
public function __construct(array<array-key, object> $projection, public Comparison $names)Parameters
$projection | array<array-key, object> | The output fields and unexpandable stars in order, as a list of Field and OpenStar |
$names | Comparison | How output names are compared |
Throws
InvalidConstruction When the projection holds anything but fields and open starsCalls 5
- function-call
array_pushline 59 - new InvalidConstruction line 61
- static-call Check::input() line 65
- function-call
array_is_listline 65 - new RowShape line 67
public function fields(): ?FieldsAnswers the complete field list, or null while a star cannot be expanded.
Returns
Test cases 2
Called from 1
public function lookup(string $name): FieldLookupLooks an output field up by name without choosing among several or guessing in an open shape.
Parameters
$name | string |
Returns
Test cases 2
Calls 3
- method-call QueryFact::fields() line 91
- method-call Comparison::equal() line 97
- new DependentField line 102
Test cases 8§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
QueryFactTest::testFieldsIsNullWhileAStarCannotBeExpandedcallsQueryFactTest::testFieldsListsACompleteProjectionInOrdercallsQueryFactTest::testLookupDistinguishesUniqueAndAbsentInACompleteShapecallsQueryFactTest::testLookupIsDependentInAnOpenShapeEvenWhenACandidateIsKnowncallsQueryFactTest::testLookupIsNotReachedForAProjectionItemThatIsNeitherFieldNorStarcallsQueryFactTest::testLookupIsNotReachedForAProjectionThatIsNoListcalls
Other tests reaching this symbol 2
Relations§
Instantiated in 6
- new SqlSemantics\Platform\Sqlite\Rules\Definition\ExplainRows::fact() packages/sql-semantics-sqlite/src/Rules/Definition/ExplainRows.php:73
- new SqlSemantics\Platform\Sqlite\Rules\Mutation\MutationScope::returning() packages/sql-semantics-sqlite/src/Rules/Mutation/MutationScope.php:113
- new SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:89
- new SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts::derive() packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:71
- new SqlSemantics\Platform\Sqlite\Statement\Query\ValuesClause::deriveQuery() packages/sql-semantics-sqlite/src/Statement/Query/ValuesClause.php:93
- new SqlSemantics\Platform\Sqlite\Statement\Query\With\WithQuery::deriveQuery() packages/sql-semantics-sqlite/src/Statement/Query/With/WithQuery.php:61
Type declarations 27
- type SqlSemantics\Platform\Sqlite\Model\Construction\Derivation packages/sql-semantics-sqlite/src/Model/Construction/Derivation.php:62
- type SqlSemantics\Platform\Sqlite\Model\Construction\Derivation packages/sql-semantics-sqlite/src/Model/Construction/Derivation.php:203
- type SqlSemantics\Platform\Sqlite\Model\Construction\Derivation packages/sql-semantics-sqlite/src/Model/Construction/Derivation.php:237
- type SqlSemantics\Platform\Sqlite\Model\Statement\Fact\Facts packages/sql-semantics-sqlite/src/Model/Statement/Fact/Facts.php:62
- type SqlSemantics\Platform\Sqlite\Model\Statement\Fact\Facts packages/sql-semantics-sqlite/src/Model/Statement/Fact/Facts.php:116
- type SqlSemantics\Platform\Sqlite\Model\Statement\Query packages/sql-semantics-sqlite/src/Model/Statement/Query.php:27
- type SqlSemantics\Platform\Sqlite\Rules\Definition\ExplainRows packages/sql-semantics-sqlite/src/Rules/Definition/ExplainRows.php:66
- type SqlSemantics\Platform\Sqlite\Rules\Definition\Query\QueryColumns packages/sql-semantics-sqlite/src/Rules/Definition/Query/QueryColumns.php:69
- type SqlSemantics\Platform\Sqlite\Rules\Definition\Query\QueryColumns packages/sql-semantics-sqlite/src/Rules/Definition/Query/QueryColumns.php:93
- type SqlSemantics\Platform\Sqlite\Rules\Definition\Query\QueryColumns packages/sql-semantics-sqlite/src/Rules/Definition/Query/QueryColumns.php:167
- type SqlSemantics\Platform\Sqlite\Rules\Definition\Query\QueryColumns packages/sql-semantics-sqlite/src/Rules/Definition/Query/QueryColumns.php:189
- type SqlSemantics\Platform\Sqlite\Rules\Mutation\InsertFacts packages/sql-semantics-sqlite/src/Rules/Mutation/InsertFacts.php:52
- type SqlSemantics\Platform\Sqlite\Rules\Mutation\MutationScope packages/sql-semantics-sqlite/src/Rules/Mutation/MutationScope.php:107
- type SqlSemantics\Platform\Sqlite\Rules\Query\CommonTables packages/sql-semantics-sqlite/src/Rules/Query/CommonTables.php:128
- type SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:62
- type SqlSemantics\Platform\Sqlite\Rules\Query\CompoundFacts packages/sql-semantics-sqlite/src/Rules/Query/CompoundFacts.php:173
- type SqlSemantics\Platform\Sqlite\Rules\Query\RelationNames packages/sql-semantics-sqlite/src/Rules/Query/RelationNames.php:56
- type SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:44
- type SqlSemantics\Platform\Sqlite\Statement\Mutation\Delete packages/sql-semantics-sqlite/src/Statement/Mutation/Delete.php:71
- type SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertDefaults packages/sql-semantics-sqlite/src/Statement/Mutation/InsertDefaults.php:67
- type SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertRows packages/sql-semantics-sqlite/src/Statement/Mutation/InsertRows.php:80
- type SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertSelect packages/sql-semantics-sqlite/src/Statement/Mutation/InsertSelect.php:86
- type SqlSemantics\Platform\Sqlite\Statement\Mutation\Update packages/sql-semantics-sqlite/src/Statement/Mutation/Update.php:103
- type SqlSemantics\Platform\Sqlite\Statement\Query\Compound packages/sql-semantics-sqlite/src/Statement/Query/Compound.php:85
- type SqlSemantics\Platform\Sqlite\Statement\Query\Select packages/sql-semantics-sqlite/src/Statement/Query/Select.php:119
- type SqlSemantics\Platform\Sqlite\Statement\Query\ValuesClause packages/sql-semantics-sqlite/src/Statement/Query/ValuesClause.php:68
- type SqlSemantics\Platform\Sqlite\Statement\Query\With\WithQuery packages/sql-semantics-sqlite/src/Statement/Query/With/WithQuery.php:57