From a0dc55f58317ce882ed1e78b8ade7d752e42e3af Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Sun, 28 Mar 2021 16:46:37 +0800 Subject: [PATCH] modify --- Database/SqlBuilder.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Database/SqlBuilder.php b/Database/SqlBuilder.php index a0d2965f..702e54e9 100644 --- a/Database/SqlBuilder.php +++ b/Database/SqlBuilder.php @@ -177,6 +177,9 @@ class SqlBuilder extends Component public function one(): string { $this->query->limit(0, 1); + if (empty($this->from)) { + $this->query->from($this->query->getTable()); + } return $this->_prefix(true); } @@ -187,6 +190,9 @@ class SqlBuilder extends Component */ public function all(): string { + if (empty($this->from)) { + $this->query->from($this->query->getTable()); + } return $this->_prefix(true); } @@ -197,6 +203,9 @@ class SqlBuilder extends Component */ public function count(): string { + if (empty($this->from)) { + $this->query->from($this->query->getTable()); + } return $this->_prefix(); }