classOrderItem
final class OrderItem
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One ordering or grouping expression with the direction written after it.
It is the item of ORDER BY, of the GROUP BY of releases that accept a direction there, of GROUP_CONCAT ... ORDER BY, and of the PARTITION BY and ORDER BY of a window. No direction means ascending order; the absence is kept as written. The statement that holds the item derives its expression. Source: https://dev.mysql.com/doc/refman/8.4/en/sorting-rows.html.
$item = new \SqlSemantics\Platform\MySql\Statement\Query\OrderItem(new \SqlSemantics\Platform\MySql\Statement\Name\ColumnUse(new \SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name('a')), \SqlSemantics\Platform\MySql\Statement\Query\Direction::Descending);
[$item->expression->name->value, $item->direction] // => ['a', \SqlSemantics\Platform\MySql\Statement\Query\Direction::Descending]Properties§
public Scalar $expressionpublic Direction|null $direction = nullMethods§
public function __construct(public Scalar $expression, public Direction|null $direction = null)Parameters
$expression | Scalar | The ordering expression |
$direction | Direction|null | The direction, when written |
public function render(Output $out): voidWrites the expression and the direction.
Parameters
$out | Output |
Test cases 3
Calls 2
- method-call Output::node() line 43
- method-call Output::keyword() line 45
Test cases 22§
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 19
ChainTest::testEarlierRejectsAnOrderingAfterTheFirstOperandOfASubqueryUnioncallsChainTest::testEnclosedRejectsAnOrderingAfterAParenthesizedOperandThatLimitsItselfcallsBlockTest::testFinishKeepsALaterOrderingAfterTheLockingClausesAsTheBlocksOwncallsBlockTest::testFinishOrdersTheRowsOfABlockThatLimitsItsRowscallsClauseRuleTest::testDirectionLowersAscendingAndDescendingcallsClauseRuleTest::testPositionsWrapsUnsignedIntegerscallsTrailerTest::testThenRejectsAClauseWrittenTwicecallsWindowsTest::testDeriveDerivesTheExpressionsOfASpecificationcallsQueryTailsTest::testExpressionWritesTheOrderingAndTheLimitOnlycallsSortScopesTest::testCheckRefusesAnIntegerItemcallsAggregateTest::testDeriveScalarDerivesTheWindowcallsGroupConcatTest::testRenderWritesTheOrderingAndTheSeparatorcallsWindowSpecTest::testRenderWritesThePartscallsWindowSpecificationTest::testDeriveWindowDerivesTheExpressionscallsQueryExpressionTest::testAnIntegerOrderingItemIsRejectedcallsSelectTest::testAnIntegerOrderingItemIsRejectedcallsSelectTest::testRejectsALateOrderingAfterABlockThatOrdersItsRowscallsLeadingUnionTest::testRenderNeedsALastOperandWithOnlyItsOwnLimitOrLockingcallsSetOperationTest::testALastOperandWithItsOwnOrderingIsRejectedcalls
Relations§
Instantiated in 4
- new SqlSemantics\Platform\MySql\Lowering\Query\Shared\ClauseRule::item() packages/sql-semantics-mysql/src/Lowering/Query/Shared/ClauseRule.php:199
- new SqlSemantics\Platform\MySql\Lowering\Query\Shared\ClauseRule::item() packages/sql-semantics-mysql/src/Lowering/Query/Shared/ClauseRule.php:200
- new SqlSemantics\Platform\MySql\Lowering\Query\Shared\ClauseRule::positions() packages/sql-semantics-mysql/src/Lowering/Query/Shared/ClauseRule.php:234
- new SqlSemantics\Platform\MySql\Lowering\TableChange\Alter\ColumnItemRule::order() packages/sql-semantics-mysql/src/Lowering/TableChange/Alter/ColumnItemRule.php:250
Constant reads 11
- class-const SqlSemantics\Platform\MySql\Statement\Alter\Command\Reorder::__construct() packages/sql-semantics-mysql/src/Statement/Alter/Command/Reorder.php:44
- class-const SqlSemantics\Platform\MySql\Statement\Call\Aggregate\GroupConcat::__construct() packages/sql-semantics-mysql/src/Statement/Call/Aggregate/GroupConcat.php:74
- class-const SqlSemantics\Platform\MySql\Statement\Call\Window\WindowSpec::__construct() packages/sql-semantics-mysql/src/Statement/Call/Window/WindowSpec.php:60
- class-const SqlSemantics\Platform\MySql\Statement\Call\Window\WindowSpec::__construct() packages/sql-semantics-mysql/src/Statement/Call/Window/WindowSpec.php:61
- class-const SqlSemantics\Platform\MySql\Statement\Dml\Delete::__construct() packages/sql-semantics-mysql/src/Statement/Dml/Delete.php:60
- class-const SqlSemantics\Platform\MySql\Statement\Dml\Update::__construct() packages/sql-semantics-mysql/src/Statement/Dml/Update.php:75
- class-const SqlSemantics\Platform\MySql\Statement\Query\Clause\Grouping::__construct() packages/sql-semantics-mysql/src/Statement/Query/Clause/Grouping.php:43
- class-const SqlSemantics\Platform\MySql\Statement\Query\Clause\LateOrdering::__construct() packages/sql-semantics-mysql/src/Statement/Query/Clause/LateOrdering.php:51
- class-const SqlSemantics\Platform\MySql\Statement\Query\QueryExpression::__construct() packages/sql-semantics-mysql/src/Statement/Query/QueryExpression.php:62
- class-const SqlSemantics\Platform\MySql\Statement\Query\Select::__construct() packages/sql-semantics-mysql/src/Statement/Query/Select.php:130
- class-const SqlSemantics\Platform\MySql\Statement\Query\Set\OrderedSetOperation::__construct() packages/sql-semantics-mysql/src/Statement/Query/Set/OrderedSetOperation.php:79
Type declarations 3
- type SqlSemantics\Platform\MySql\Lowering\Query\QueryRules packages/sql-semantics-mysql/src/Lowering/Query/QueryRules.php:151
- type SqlSemantics\Platform\MySql\Lowering\Query\Shared\ClauseRule packages/sql-semantics-mysql/src/Lowering/Query/Shared/ClauseRule.php:194
- type SqlSemantics\Platform\MySql\Rules\Query\SelectFacts::derive() packages/sql-semantics-mysql/src/Rules/Query/SelectFacts.php:63