classValuesClause
final class ValuesClause
implements Statement, Query
uses Snapshot
Public API: explicitly declared with
@visibility public.A VALUES clause: a query whose rows are written out.
Rule: SQLITE-VALUES-001. The values see the enclosing queries and no relation of their own. The result has the width of the first row; a row of another width is reported. SQLite names the result columns column1, column2, and so on. The type of a column is the choice over its values and it can be NULL when one of its values can. Source: https://sqlite.org/lang_select.html#the_values_clause. Status: Implemented.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze("VALUES (1, 'a'), (2, NULL)");
[count($query->statement->rows), $query->field(1)->name->value, $query->field(1)->nullability] // => [2, 'column2', \SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability::Nullable]Properties§
public non-empty-list<ValueRow> $rowsMethods§
public function __construct(list<ValueRow> $rows)Parameters
$rows | list<ValueRow> | The rows in written order; at least one |
Calls 2
- static-call Check::listOf() line 53
- class-const ValueRow::class() line 53
public function deriveStatement(Derivation $derivation): voidDerives the clause as a statement root and records its rows as the output.
Parameters
$derivation | Derivation |
Calls 5
- method-call ProgramOnly::outsideProgram() line 61
- new ProgramOnly line 61
- method-call Derivation::output() line 62
- method-call Derivation::query() line 62
- method-call Derivation::environment() line 62
public function deriveQuery(Derivation $derivation, Environment $outer): QueryFactDerives every value and the output fields.
Parameters
$derivation | Derivation | |
$outer | Environment |
Returns
Calls 14
- new Environment line 70
- function-call
countline 71 - function-call
array_fillline 72 - class-const Nullability::NotNull() line 73
- method-call Derivation::scalar() line 77
- method-call Derivation::report() line 84
- new ArityMismatch line 84
- class-const ArityRule::ValueRows() line 84
- new Field line 90
- new OutputSlot line 90
- new Name line 90
- method-call Storages::either() line 90
- new Storages line 90
- new QueryFact line 93
public function render(Output $out): voidTest cases 27§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 24
ExpressionRuleTest::testItemsLowersTheExpressionsOfARowInWrittenOrdercallsQueryCommandsTest::testCommandLowersEveryFormOfASelectCommandcallsResultRuleTest::testValuesLowersASingleRowcallsResultRuleTest::testValuesLowersEveryRowInWrittenOrdercallsSelectRuleTest::testArmLowersASelectionOrAValuesClausecallsSelectRuleTest::testBodyLeavesACompoundThatEndsInValuesWithoutOrderByAndLimitcallsColumnTypingTest::testArmReadsAnExpandedStarAndARowValuecallsExpressionAffinityTest::testArmReadsAPositionOfASelectionOrARowcallsExpressionAffinityTest::testArmsFlattensWithClausesCompoundsAndValuesRowscallsExpressionAffinityTest::testWrittenReadsTheExpressionOfAPositionAndNothingForAStarcallsValueKindsTest::testArmReadsAnExpandedStarAndAnAbsentPositioncallsRelationNamesTest::testNamedReadsTheWordOfAValuesColumnOrItsPositioncallsResultNamesTest::testLeftmostFindsTheArmThatNamesTheColumnscallsInsertRowsTest::testRejectsANonLastUpsertWithoutAConflictTargetcallsInsertSelectTest::testRejectsABareValuesClausecallsCompoundStepTest::testRenderWritesTheOperatorBeforeTheArmcallsCompoundTest::testRenderRefusesAnOrderingAfterAValuesArmcallsCompoundTest::testRenderRefusesAnOrderingLeftOnTheLastArmcallsCompoundTest::testRenderWritesANewlyBuiltCompoundcallsValueRowTest::testRenderWritesANewlyBuiltRowcallsValueRowTest::testRenderWritesTheValuesInParenthesescallsCommonTableTest::testRenderWritesTheColumnListAndTheHintcallsWithQueryTest::testRenderWritesTheClauseAndTheBodycallsCreateTriggerTest::testRejectsAnInsertWithACorrelationNamecalls
Relations§
Instantiated in 1
Constant reads 1
Type checks 7
- instanceof SqlSemantics\Platform\Sqlite\Lowering\Mutation\MutationRule::insert() packages/sql-semantics-sqlite/src/Lowering/Mutation/MutationRule.php:124
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::arms() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:206
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\ExpressionAffinity::arms() packages/sql-semantics-sqlite/src/Rules/Definition/Query/ExpressionAffinity.php:211
- instanceof SqlSemantics\Platform\Sqlite\Rules\Definition\Query\QueryColumns::named() packages/sql-semantics-sqlite/src/Rules/Definition/Query/QueryColumns.php:103
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\RelationNames::named() packages/sql-semantics-sqlite/src/Rules/Query/RelationNames.php:97
- instanceof SqlSemantics\Platform\Sqlite\Rules\Query\ResultNames::leftmost() packages/sql-semantics-sqlite/src/Rules/Query/ResultNames.php:213
- instanceof SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertSelect::__construct() packages/sql-semantics-sqlite/src/Statement/Mutation/InsertSelect.php:63
Type declarations 11
- type SqlSemantics\Platform\Sqlite\Lowering\Query\ResultRule packages/sql-semantics-sqlite/src/Lowering/Query/ResultRule.php:160
- type SqlSemantics\Platform\Sqlite\Lowering\Query\SelectRule packages/sql-semantics-sqlite/src/Lowering/Query/SelectRule.php:61
- type SqlSemantics\Platform\Sqlite\Lowering\Query\SelectRule packages/sql-semantics-sqlite/src/Lowering/Query/SelectRule.php:78
- type SqlSemantics\Platform\Sqlite\Lowering\Query\SelectRule packages/sql-semantics-sqlite/src/Lowering/Query/SelectRule.php:125
- type SqlSemantics\Platform\Sqlite\Lowering\Trigger\TriggerRule packages/sql-semantics-sqlite/src/Lowering/Trigger/TriggerRule.php:155
- type SqlSemantics\Platform\Sqlite\Rules\Query\RelationNames packages/sql-semantics-sqlite/src/Rules/Query/RelationNames.php:94
- type SqlSemantics\Platform\Sqlite\Rules\Query\ResultNames packages/sql-semantics-sqlite/src/Rules/Query/ResultNames.php:207
- type SqlSemantics\Platform\Sqlite\Statement\Mutation\InsertRows packages/sql-semantics-sqlite/src/Statement/Mutation/InsertRows.php:56
- type SqlSemantics\Platform\Sqlite\Statement\Query\Compound packages/sql-semantics-sqlite/src/Statement/Query/Compound.php:61
- type SqlSemantics\Platform\Sqlite\Statement\Query\CompoundStep packages/sql-semantics-sqlite/src/Statement/Query/CompoundStep.php:27
- type SqlSemantics\Platform\Sqlite\Statement\Query\With\WithQuery packages/sql-semantics-sqlite/src/Statement/Query/With/WithQuery.php:41