From c84d9f8328a50fdaa40c481e70b7f822dd7d19a1 Mon Sep 17 00:00:00 2001 From: whwyy Date: Wed, 13 Dec 2023 16:19:16 +0800 Subject: [PATCH] eee --- SqlBuilder.php | 5 ++++- Traits/QueryTrait.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/SqlBuilder.php b/SqlBuilder.php index 2e511d6..e4d2461 100644 --- a/SqlBuilder.php +++ b/SqlBuilder.php @@ -317,7 +317,10 @@ class SqlBuilder extends Component private function makeLimit(): string { - return ' LIMIT ' . $this->query->offset . ',' . $this->query->limit; + if ($this->query->offset >= 0 && $this->query->limit >= 1) { + return ' LIMIT ' . $this->query->offset . ',' . $this->query->limit; + } + return ''; } diff --git a/Traits/QueryTrait.php b/Traits/QueryTrait.php index c1fdf89..2682a9c 100644 --- a/Traits/QueryTrait.php +++ b/Traits/QueryTrait.php @@ -31,8 +31,8 @@ abstract class QueryTrait extends Component implements ActiveQueryInterface, ISq public array $select = ['*']; public array $join = []; public array $order = []; - public int $offset = 0; - public int $limit = 0; + public int $offset = -1; + public int $limit = -1; public string $group = ''; public string $from = ''; public string $alias = 't1';