Thomas Bruederli
2013-03-23 b2c66d03317a75cdc83e878541627534d43db1f7
Hack to reset PDO statement iterators after counting
1 files modified
5 ■■■■ changed files
program/lib/Roundcube/rcube_db.php 5 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_db.php
@@ -444,6 +444,7 @@
     *
     * @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 @@
                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;
            }
        }