classLimit
final class Limit
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The LIMIT clause: the largest number of rows to return and the number of rows to skip first.
SQLite has two spellings for a limit with an offset, LIMIT count OFFSET offset and LIMIT offset, count; the model keeps which one is written. Source: https://sqlite.org/lang_select.html#the_limit_clause.
$query = (new \SqlSemantics\Platform\Sqlite\Semantics())->analyze('SELECT a FROM t LIMIT 5, 10');
[$query->statement->limit->offset->digits, $query->statement->limit->count->digits, $query->statement->limit->comma] // => ['5', '10', true]new \SqlSemantics\Platform\Sqlite\Statement\Query\Limit(new \SqlSemantics\Platform\Sqlite\Statement\Expression\Literal\IntegerLiteral('1'), null, true) // throws \SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstructionProperties§
public Scalar $countpublic Scalar|null $offset = nullpublic bool $comma = falseMethods§
public function __construct(
public Scalar $count,
public Scalar|null $offset = null,
public bool $comma = false,
)Parameters
$count | Scalar | The largest number of rows |
$offset | Scalar|null | The number of rows to skip |
$comma | bool | Whether the offset is written first, before a comma |
Calls 1
- static-call Check::input() line 38
public function render(Output $out): voidWrites the clause in the spelling kept.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 46
- method-call Output::node() line 48
Test cases 4§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 2
Relations§
Instantiated in 3
- new SqlSemantics\Platform\Sqlite\Lowering\Query\SelectRule::limit() packages/sql-semantics-sqlite/src/Lowering/Query/SelectRule.php:208
- new SqlSemantics\Platform\Sqlite\Lowering\Query\SelectRule::limit() packages/sql-semantics-sqlite/src/Lowering/Query/SelectRule.php:213
- new SqlSemantics\Platform\Sqlite\Lowering\Query\SelectRule::limit() packages/sql-semantics-sqlite/src/Lowering/Query/SelectRule.php:214
Type declarations 4
- type SqlSemantics\Platform\Sqlite\Lowering\Query\SelectRule packages/sql-semantics-sqlite/src/Lowering/Query/SelectRule.php:201
- type SqlSemantics\Platform\Sqlite\Rules\Query\SelectFacts packages/sql-semantics-sqlite/src/Rules/Query/SelectFacts.php:101
- type SqlSemantics\Platform\Sqlite\Statement\Query\Compound packages/sql-semantics-sqlite/src/Statement/Query/Compound.php:61
- type SqlSemantics\Platform\Sqlite\Statement\Query\Select packages/sql-semantics-sqlite/src/Statement/Query/Select.php:86