classRowLimit
final class RowLimit
implements Limit
uses Snapshot
Public API: explicitly declared with
@visibility public.A LIMIT clause: a row count and an optional offset.
Each operand is an unsigned integer literal, a parameter marker or a stored program variable; MySQL accepts no other expression there. The spelling of an offset is kept because LIMIT offset, count and LIMIT count OFFSET offset write the operands in opposite order. The statement that holds the clause derives its operands, which see no column. Source: https://dev.mysql.com/doc/refman/8.4/en/select.html.
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t LIMIT 10 OFFSET 5');
[$query->statement->limit->count->text, $query->statement->limit->offset->text] // => ['10', '5']new \SqlSemantics\Platform\MySql\Statement\Query\Clause\RowLimit(new \SqlSemantics\Platform\MySql\Statement\Literal\NumberLiteral('1.5')) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstructionProperties§
public Scalar $countpublic Scalar|null $offset = nullpublic OffsetSpelling|null $spelling = nullMethods§
public function __construct(
public Scalar $count,
public Scalar|null $offset = null,
public OffsetSpelling|null $spelling = null,
)Parameters
$count | Scalar | The row count |
$offset | Scalar|null | The number of rows skipped |
$spelling | OffsetSpelling|null | How the offset is written; given exactly when there is an offset |
Calls 2
- static-call Check::input() line 45
- class-const NumberForm::Integer() line 45
public function render(Output $out): voidWrites the clause.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 55
- class-const OffsetSpelling::Comma() line 56
- method-call Output::node() line 57
- class-const OffsetSpelling::Keyword() line 60
Test cases 37§
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 34
ChainTest::testEarlierKeepsALimitBeforeTheLastOperandIn56callsChainTest::testEarlierRejectsALimitBeforeTheLastOperandIn57callsChainTest::testEnclosedKeepsTheClausesAfterTheFirstParenthesizedOperandcallsChainTest::testEnclosedRejectsAnOrderingAfterAParenthesizedOperandThatLimitsItselfcallsChainTest::testEnclosedRejectsClausesAfterALaterParenthesizedOperandcallsChainTest::testQueryLiftsTheClausesOfTheLastBlockcallsChainTest::testQueryOrdersAUnionAfterTheClausesOfItsLastBlockcallsBlockTest::testBareDropsTheClausesWrittenAfterTheBlockcallsBlockTest::testFinishKeepsASecondLimitAsTheLimitThatReplacesTheFirstcallsBlockTest::testFinishOrdersTheRowsOfABlockThatLimitsItsRowscallsBlockTest::testFinishWritesClausesInPlaceWhenNothingOfTheBlockPrecedesThemcallsBlockTest::testThenAddsTheClausesWrittenAfterTheBlockcallsTrailerTest::testEmptyTellsWhetherAClauseIsWrittencallsTrailerTest::testThenCombinesTheClausesOfBothTrailerscallsTrailerTest::testWrapPutsTheOrderingAndTheLockingAroundAQuerycallsChangeFactsTest::testClausesDeriveLimitWithoutTablescallsQueryTailsTest::testExpressionWritesTheOrderingAndTheLimitOnlycallsQueryTailsTest::testLeadingWritesUnionTheQuantifierAndTheLastOperandcallsSetFactsTest::testLeadingRefusesAnOwnLimitOnMySql57callsTailFactsTest::testLimitDerivesTheOperandscallsShowFactsTest::testLimitDerivesTheOperandscallsLateOrderingTest::testRenderWritesALimitThatReplacesTheLimitOfTheBlockcallsProgramVariableTest::testDeriveScalarDependsOnTheStoredProgramcallsQueryExpressionTest::testAnOrderingOverASingleBlockIsRejectedcallsSelectTest::testDeriveQueryRefusesALateOrderingBefore56callsSelectTest::testDeriveStatementRefusesALateOrderingAtTheTopcallsSelectTest::testRejectsALateOrderingAfterABlockThatOrdersItsRowscallsSelectTest::testRejectsALateOrderingThatIsWrittenInPlacecallsLeadingUnionTest::testRenderNeedsMySql5ForTheFormAndMySql56ForAnOwnLimitcallsLeadingUnionTest::testRenderNeedsUnionAfterItcallsOrderedSetOperationTest::testDeriveQueryNeedsMySql56callsOrderedSetOperationTest::testRejectsALastSelectWithoutClausesOfItsOwncallsOrderedSetOperationTest::testRejectsAsAnOperandOfAnotherSetOperationcallsSetOperationTest::testAQueryExpressionOnTheRightIsRejectedcalls
Relations§
Instantiated in 5
- new SqlSemantics\Platform\MySql\Lowering\Dml\ChangeRule::limit() packages/sql-semantics-mysql/src/Lowering/Dml/ChangeRule.php:202
- new SqlSemantics\Platform\MySql\Lowering\Query\Shared\TailRule::limit() packages/sql-semantics-mysql/src/Lowering/Query/Shared/TailRule.php:83
- new SqlSemantics\Platform\MySql\Lowering\Query\Shared\TailRule::options() packages/sql-semantics-mysql/src/Lowering/Query/Shared/TailRule.php:98
- new SqlSemantics\Platform\MySql\Lowering\Query\Shared\TailRule::options() packages/sql-semantics-mysql/src/Lowering/Query/Shared/TailRule.php:99
- new SqlSemantics\Platform\MySql\Lowering\Query\Shared\TailRule::options() packages/sql-semantics-mysql/src/Lowering/Query/Shared/TailRule.php:100