From 745aa7ce35e6bb56d7120dabcc2a76f129eb5f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Nowacki?= Date: Thu, 13 Sep 2018 16:46:51 +0200 Subject: [PATCH] optional reset in countAll (as is in countAllResults) --- system/Database/BaseBuilder.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/system/Database/BaseBuilder.php b/system/Database/BaseBuilder.php index c4b0847b3656..93659ff306fa 100644 --- a/system/Database/BaseBuilder.php +++ b/system/Database/BaseBuilder.php @@ -1396,11 +1396,12 @@ public function get(int $limit = null, int $offset = 0, $returnSQL = false) * Generates a platform-specific query string that counts all records in * the specified database * + * @param bool $reset Are we want to clear query builder values. * @param bool $test Are we running automated tests? * * @return int */ - public function countAll($test = false) + public function countAll($reset = true, $test = false) { $table = $this->QBFrom[0]; @@ -1419,7 +1420,11 @@ public function countAll($test = false) } $query = $query->getRow(); - $this->resetSelect(); + + if ($reset === true) + { + $this->resetSelect(); + } return (int) $query->numrows; }