From a85d54e1e801b07a152a717fbfca08c8eadad201 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Sat, 23 Mar 2013 17:57:58 +0100 Subject: Hack to reset PDO statement iterators after counting --- program/lib/Roundcube/rcube_db.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'program/lib/Roundcube/rcube_db.php') diff --git a/program/lib/Roundcube/rcube_db.php b/program/lib/Roundcube/rcube_db.php index 49bbe5c6e..ec61cb6b3 100644 --- a/program/lib/Roundcube/rcube_db.php +++ b/program/lib/Roundcube/rcube_db.php @@ -444,6 +444,7 @@ class rcube_db * * @param mixed $result Optional query handle * @return mixed Number of rows or false on failure + * @deprecated This method shows very poor performance and should be avoided. */ public function num_rows($result = null) { @@ -454,7 +455,9 @@ class rcube_db return $query ? intval($query->fetchColumn(0)) : false; } else { - return count($result->fetchAll()); + $num = count($result->fetchAll()); + $result->execute(); // re-execute query because there's no seek(0) + return $num; } } -- cgit v1.2.3