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\MySql\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
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
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.
Other tests reaching this symbol 8
SubqueryRowsTest::testTestCombinesTheColumnsAndReportsAWidthMismatchcallsSubqueryRowsTest::testValueIsTheOneColumnOrARowcallsCommonTablesTest::testAnchoredBindsTheColumnsOfTheNonrecursivePartcallsCommonTablesTest::testNullableMakesEveryColumnNullablecallsCommonTablesTest::testShapeRenamesTheColumnsByTheColumnListcallsDerivedShapesTest::testShapeTakesTheSlotsOfTheQuerycallsResultSlotsTest::testCombineNamesAfterTheLeftOperandcallsTailFactsTest::testDeriveReportsAnUnknownLockedTablecalls
Relations§
Instantiated in 9
- new SqlSemantics\Platform\MySql\Rules\Dml\HandlerFacts::read() packages/sql-semantics-mysql/src/Rules/Dml/HandlerFacts.php:47
- new SqlSemantics\Platform\MySql\Rules\Query\CommonTables::nullable() packages/sql-semantics-mysql/src/Rules/Query/CommonTables.php:144
- new SqlSemantics\Platform\MySql\Rules\Query\ResultSlots::values() packages/sql-semantics-mysql/src/Rules/Query/ResultSlots.php:122
- new SqlSemantics\Platform\MySql\Rules\Query\SelectFacts::derive() packages/sql-semantics-mysql/src/Rules/Query/SelectFacts.php:90
- new SqlSemantics\Platform\MySql\Rules\Query\SetFacts::operands() packages/sql-semantics-mysql/src/Rules/Query/SetFacts.php:55
- new SqlSemantics\Platform\MySql\Rules\Query\TableShapes::explicit() packages/sql-semantics-mysql/src/Rules/Query/TableShapes.php:103
- new SqlSemantics\Platform\MySql\Rules\Server\AdminRows::record() packages/sql-semantics-mysql/src/Rules/Server/AdminRows.php:79
- new SqlSemantics\Platform\MySql\Rules\Utility\ShowFacts::query() packages/sql-semantics-mysql/src/Rules/Utility/ShowFacts.php:105
- new SqlSemantics\Platform\MySql\Rules\Utility\ShowFacts::query() packages/sql-semantics-mysql/src/Rules/Utility/ShowFacts.php:112
Type declarations 36
- type SqlSemantics\Platform\MySql\Model\Construction\Derivation packages/sql-semantics-mysql/src/Model/Construction/Derivation.php:62
- type SqlSemantics\Platform\MySql\Model\Construction\Derivation packages/sql-semantics-mysql/src/Model/Construction/Derivation.php:203
- type SqlSemantics\Platform\MySql\Model\Construction\Derivation packages/sql-semantics-mysql/src/Model/Construction/Derivation.php:237
- type SqlSemantics\Platform\MySql\Model\Statement\Fact\Facts packages/sql-semantics-mysql/src/Model/Statement/Fact/Facts.php:62
- type SqlSemantics\Platform\MySql\Model\Statement\Fact\Facts packages/sql-semantics-mysql/src/Model/Statement/Fact/Facts.php:116
- type SqlSemantics\Platform\MySql\Model\Statement\Query packages/sql-semantics-mysql/src/Model/Statement/Query.php:27
- type SqlSemantics\Platform\MySql\Rules\Dml\GeneratedWrites packages/sql-semantics-mysql/src/Rules/Dml/GeneratedWrites.php:96
- type SqlSemantics\Platform\MySql\Rules\Expression\SubqueryRows packages/sql-semantics-mysql/src/Rules/Expression/SubqueryRows.php:37
- type SqlSemantics\Platform\MySql\Rules\Expression\SubqueryRows packages/sql-semantics-mysql/src/Rules/Expression/SubqueryRows.php:53
- type SqlSemantics\Platform\MySql\Rules\Query\CommonTables packages/sql-semantics-mysql/src/Rules/Query/CommonTables.php:110
- type SqlSemantics\Platform\MySql\Rules\Query\CommonTables packages/sql-semantics-mysql/src/Rules/Query/CommonTables.php:123
- type SqlSemantics\Platform\MySql\Rules\Query\CommonTables packages/sql-semantics-mysql/src/Rules/Query/CommonTables.php:137
- type SqlSemantics\Platform\MySql\Rules\Query\DerivedShapes packages/sql-semantics-mysql/src/Rules/Query/DerivedShapes.php:44
- type SqlSemantics\Platform\MySql\Rules\Query\ExpressionFacts packages/sql-semantics-mysql/src/Rules/Query/ExpressionFacts.php:34
- type SqlSemantics\Platform\MySql\Rules\Query\ExpressionFacts packages/sql-semantics-mysql/src/Rules/Query/ExpressionFacts.php:48
- type SqlSemantics\Platform\MySql\Rules\Query\ResultSlots packages/sql-semantics-mysql/src/Rules/Query/ResultSlots.php:50
- type SqlSemantics\Platform\MySql\Rules\Query\ResultSlots packages/sql-semantics-mysql/src/Rules/Query/ResultSlots.php:100
- type SqlSemantics\Platform\MySql\Rules\Query\SelectFacts packages/sql-semantics-mysql/src/Rules/Query/SelectFacts.php:58
- type SqlSemantics\Platform\MySql\Rules\Query\SetFacts packages/sql-semantics-mysql/src/Rules/Query/SetFacts.php:41
- type SqlSemantics\Platform\MySql\Rules\Query\SetFacts packages/sql-semantics-mysql/src/Rules/Query/SetFacts.php:49
- type SqlSemantics\Platform\MySql\Rules\Query\SetFacts packages/sql-semantics-mysql/src/Rules/Query/SetFacts.php:65
- type SqlSemantics\Platform\MySql\Rules\Query\TableShapes packages/sql-semantics-mysql/src/Rules/Query/TableShapes.php:93
- type SqlSemantics\Platform\MySql\Rules\Query\TailFacts packages/sql-semantics-mysql/src/Rules/Query/TailFacts.php:43
- 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:166
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableDeclaration packages/sql-semantics-mysql/src/Rules/TableDefinition/TableDeclaration.php:216
- type SqlSemantics\Platform\MySql\Rules\TableDefinition\TableProblems packages/sql-semantics-mysql/src/Rules/TableDefinition/TableProblems.php:117
- type SqlSemantics\Platform\MySql\Rules\Utility\ShowFacts packages/sql-semantics-mysql/src/Rules/Utility/ShowFacts.php:102
- type SqlSemantics\Platform\MySql\Statement\Query\ExplicitTable packages/sql-semantics-mysql/src/Statement/Query/ExplicitTable.php:76
- type SqlSemantics\Platform\MySql\Statement\Query\ParenthesizedQuery packages/sql-semantics-mysql/src/Statement/Query/ParenthesizedQuery.php:55
- type SqlSemantics\Platform\MySql\Statement\Query\QueryExpression packages/sql-semantics-mysql/src/Statement/Query/QueryExpression.php:80
- type SqlSemantics\Platform\MySql\Statement\Query\QueryStatement packages/sql-semantics-mysql/src/Statement/Query/QueryStatement.php:78
- type SqlSemantics\Platform\MySql\Statement\Query\Select packages/sql-semantics-mysql/src/Statement/Query/Select.php:179
- type SqlSemantics\Platform\MySql\Statement\Query\Set\OrderedSetOperation packages/sql-semantics-mysql/src/Statement/Query/Set/OrderedSetOperation.php:91
- type SqlSemantics\Platform\MySql\Statement\Query\Set\SetOperation packages/sql-semantics-mysql/src/Statement/Query/Set/SetOperation.php:78
- type SqlSemantics\Platform\MySql\Statement\Query\ValuesQuery packages/sql-semantics-mysql/src/Statement/Query/ValuesQuery.php:61