final class RowLimit
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The LIMIT, FETCH FIRST and OFFSET clauses of a query, in the order written.

Mirrors limitCount, limitOffset and limitOption of PostgreSQL's SelectStmt. The count and the offset may be written in either order; the order is kept. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-LIMIT.

Keeping an offset written before the limitdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 OFFSET 1 LIMIT 2');
    [$query->statement->options->limit->offsetFirst, $query->toString()] // => [true, 'SELECT 1 OFFSET 1 LIMIT 2']
Refusing an empty limitdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Query\Limit\RowLimit() // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public LimitCount|CommaLimit|FetchFirst|null $count = null
public Offset|null $offset = null
public bool $offsetFirst = false

Methods§

public function __construct(
    public LimitCount|CommaLimit|FetchFirst|null $count = null,
    public Offset|null $offset = null,
    public bool $offsetFirst = false,
)

Parameters

$countLimitCount|CommaLimit|FetchFirst|nullThe row count clause
$offsetOffset|nullThe offset clause
$offsetFirstboolWhether the offset is written before the count
Calls 1
public function render(Output $out): void

Writes the count and the offset in the order written.

Parameters

$outOutput
Calls 1

Test cases 3§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1
Other tests reaching this symbol 2

Relations§

Instantiated in 4
Type declarations 3