summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-03-23 17:57:58 +0100
committerThomas Bruederli <thomas@roundcube.net>2013-03-23 17:57:58 +0100
commita85d54e1e801b07a152a717fbfca08c8eadad201 (patch)
treedd33b393b1b719030f28a83edec39ff5a6780fee /program/lib/Roundcube
parentd227eda9cba8f120b49ab6b9d6d3b46651f8c6c2 (diff)
Hack to reset PDO statement iterators after counting
Diffstat (limited to 'program/lib/Roundcube')
-rw-r--r--program/lib/Roundcube/rcube_db.php5
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;
}
}