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.

Reading the row count and the offsetdoctest
$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']
Refusing an expression as a row countdoctest
new \SqlSemantics\Platform\MySql\Statement\Query\Clause\RowLimit(new \SqlSemantics\Platform\MySql\Statement\Literal\NumberLiteral('1.5')) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstruction

Properties§

public Scalar $count
public Scalar|null $offset = null
public OffsetSpelling|null $spelling = null

Methods§

public function __construct(
    public Scalar $count,
    public Scalar|null $offset = null,
    public OffsetSpelling|null $spelling = null,
)

Parameters

$countScalarThe row count
$offsetScalar|nullThe number of rows skipped
$spellingOffsetSpelling|nullHow the offset is written; given exactly when there is an offset
Calls 2
public function render(Output $out): void

Writes the clause.

Parameters

$outOutput
Calls 4

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

Relations§

Instantiated in 5
Type checks 2
Type declarations 2