|
30 | 30 | use function array_filter; |
31 | 31 | use function array_merge; |
32 | 32 | use function array_shift; |
33 | | -use function ctype_digit; |
34 | 33 | use function implode; |
35 | 34 | use function is_array; |
36 | 35 | use function is_bool; |
@@ -265,12 +264,14 @@ public function buildLimit(ExpressionInterface|int|null $limit, ExpressionInterf |
265 | 264 | { |
266 | 265 | $sql = ''; |
267 | 266 |
|
268 | | - if ($this->hasLimit($limit)) { |
269 | | - $sql = 'LIMIT ' . ($limit instanceof ExpressionInterface ? $this->buildExpression($limit) : (string) $limit); |
| 267 | + if ($limit !== null) { |
| 268 | + $sql = 'LIMIT ' |
| 269 | + . ($limit instanceof ExpressionInterface ? $this->buildExpression($limit) : (string) $limit); |
270 | 270 | } |
271 | 271 |
|
272 | | - if ($this->hasOffset($offset)) { |
273 | | - $sql .= ' OFFSET ' . ($offset instanceof ExpressionInterface ? $this->buildExpression($offset) : (string) $offset); |
| 272 | + if (!empty($offset)) { |
| 273 | + $sql .= ' OFFSET ' |
| 274 | + . ($offset instanceof ExpressionInterface ? $this->buildExpression($offset) : (string) $offset); |
274 | 275 | } |
275 | 276 |
|
276 | 277 | return ltrim($sql); |
@@ -552,30 +553,6 @@ protected function extractAlias(string $table): array|bool |
552 | 553 | return false; |
553 | 554 | } |
554 | 555 |
|
555 | | - /** |
556 | | - * Checks to see if the given limit is effective. |
557 | | - * |
558 | | - * @param mixed $limit The given limit. |
559 | | - * |
560 | | - * @return bool Whether the limit is effective. |
561 | | - */ |
562 | | - protected function hasLimit(mixed $limit): bool |
563 | | - { |
564 | | - return ($limit instanceof ExpressionInterface) || ctype_digit((string) $limit); |
565 | | - } |
566 | | - |
567 | | - /** |
568 | | - * Checks to see if the given offset is effective. |
569 | | - * |
570 | | - * @param mixed $offset The given offset. |
571 | | - * |
572 | | - * @return bool Whether the offset is effective. |
573 | | - */ |
574 | | - protected function hasOffset(mixed $offset): bool |
575 | | - { |
576 | | - return ($offset instanceof ExpressionInterface) || (ctype_digit((string)$offset) && (string)$offset !== '0'); |
577 | | - } |
578 | | - |
579 | 556 | /** |
580 | 557 | * @throws Exception |
581 | 558 | * @throws InvalidConfigException |
|
0 commit comments