classValuesQuery
final class ValuesQuery
implements Statement, Query
uses Snapshot
Public API: explicitly declared with
@visibility public.The VALUES statement: a table of rows written with row constructors (MySQL 8.0.19 and later).
Rule: MYSQL-VALUES-001. The columns are named column_0, column_1 and so on; the type of a column is aggregated over the rows (MYSQL-RESULT-SLOTS-001) and it can be NULL when a value of it can. Rows of different lengths are reported. The values see no column of the query. Source: https://dev.mysql.com/doc/refman/8.4/en/values.html. Status: Implemented.
$values = new \SqlSemantics\Platform\MySql\Statement\Query\ValuesQuery([new \SqlSemantics\Platform\MySql\Statement\Query\ValueRow([new \SqlSemantics\Platform\MySql\Statement\Literal\NumberLiteral('1')])]);
count($values->rows) // => 1new \SqlSemantics\Platform\MySql\Statement\Query\ValuesQuery([]) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
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 47
- class-const ValueRow::class() line 47
public function deriveStatement(Derivation $derivation): voidDerives the statement as a statement root and records its rows as the output.
Parameters
$derivation | Derivation |
Calls 3
- method-call Derivation::output() line 55
- method-call Derivation::query() line 55
- method-call Derivation::environment() line 55
public function deriveQuery(Derivation $derivation, Environment $outer): QueryFactDerives every value and the output columns.
Parameters
$derivation | Derivation | |
$outer | Environment |
Returns
Calls 2
- method-call ResultSlots::values() line 63
- new ResultSlots line 63
public function render(Output $out): voidTest cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
ValuesQueryTest::testAStatementWithoutRowsIsRejectedcallsValuesQueryTest::testDeriveQueryNamesTheColumnsAndCombinesTheRowscallsValuesQueryTest::testDeriveQueryReportsRowsOfDifferentLengthscallsValuesQueryTest::testDeriveStatementRecordsTheRowsAsTheOutputcallsValuesQueryTest::testRenderWritesTheRowscalls
Other tests reaching this symbol 2
Relations§
Instantiated in 1
Type checks 1
Type declarations 3
- type SqlSemantics\Platform\MySql\Lowering\Query\Modern\PrimaryRule packages/sql-semantics-mysql/src/Lowering/Query/Modern/PrimaryRule.php:108
- type SqlSemantics\Platform\MySql\Rules\Dml\GeneratedWrites packages/sql-semantics-mysql/src/Rules/Dml/GeneratedWrites.php:120
- type SqlSemantics\Platform\MySql\Rules\Query\ResultSlots packages/sql-semantics-mysql/src/Rules/Query/ResultSlots.php:100