diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2013-03-23 17:57:58 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2013-03-23 17:57:58 +0100 |
commit | a85d54e1e801b07a152a717fbfca08c8eadad201 (patch) | |
tree | dd33b393b1b719030f28a83edec39ff5a6780fee | |
parent | d227eda9cba8f120b49ab6b9d6d3b46651f8c6c2 (diff) |
Hack to reset PDO statement iterators after counting
-rw-r--r-- | program/lib/Roundcube/rcube_db.php | 5 |
1 files changed, 4 insertions, 1 deletions
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; } } |