]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15719 "overview report slow for large data sets - count sql operation for table...
authorjamiesensei <jamiesensei>
Sun, 20 Jul 2008 12:21:59 +0000 (12:21 +0000)
committerjamiesensei <jamiesensei>
Sun, 20 Jul 2008 12:21:59 +0000 (12:21 +0000)
lib/tablelib.php

index dadf87074d59e64242cd8589a3847d79cf168d7b..e682d0289826be362d6233affe749a45deaa4c1b 100644 (file)
@@ -1187,8 +1187,10 @@ class table_sql extends flexible_table{
             if ($this->get_sql_where()) {
                 $this->countsql .= ' AND '.$this->get_sql_where();
                 $this->sql->where .= ' AND '.$this->get_sql_where();
+                $total  = $DB->count_records_sql($this->countsql, $this->countparams);
+            } else {
+                $total = $totalinitials;
             }
-            $total  = $DB->count_records_sql($this->countsql, $this->countparams);
 
 
             $this->pagesize($pagesize, $total);