]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15070 dml: recordset rewinding now forbidden - not all databases support it,...
authorskodak <skodak>
Tue, 28 Oct 2008 12:14:09 +0000 (12:14 +0000)
committerskodak <skodak>
Tue, 28 Oct 2008 12:14:09 +0000 (12:14 +0000)
lib/dml/adodb_moodle_recordset.php
lib/dml/moodle_recordset.php
lib/dml/mysqli_native_moodle_recordset.php
lib/dml/pdo_moodle_recordset.php
lib/dml/pgsql_native_moodle_recordset.php
user/index.php

index 0b325ea734160e7d2c9891a3533bd1b3fa0ff31f..81a44ecbe2c50ffdb762aef348121ba76a64bd2f 100644 (file)
@@ -27,10 +27,6 @@ class adodb_moodle_recordset extends moodle_recordset {
         $this->rs->MoveNext();
     }
 
-    public function rewind() {
-        $this->rs->MoveFirst();
-    }
-
     public function valid() {
         return !$this->rs->EOF;
     }
index 4c18fe532d6176fc266f2503984d5082a049c616..8aa6f76ab507f7058e4120759518d340dacd04ac 100644 (file)
@@ -31,10 +31,13 @@ abstract class moodle_recordset implements Iterator {
     //public abstract function next();
 
     /**
-     * Revinds back to the first row
+     * Revinds are not supported!
      * @return void
      */
-    //public abstract function rewind();
+    public function rewind() {
+        // no seeking, sorry - let's ignore it ;-)
+        return;
+    }
 
     /**
      * Did we reach the end?
index 7917676a4c92fc5475412186d962a4d85c487e56..13e7577722d5ac8ce0bac8649a75f34f8e3fd01c 100644 (file)
@@ -40,10 +40,6 @@ class mysqli_native_moodle_recordset extends moodle_recordset {
         $this->current = $this->fetch_next();
     }
 
-    public function rewind() {
-        // we can not seek, sorry - let's ignore it ;-)
-    }
-
     public function valid() {
         return !empty($this->current);
     }
index 3122b7035c48c65b67bda0090e0ff008120536a6..aa65dcc3f42435080b3851e5c324e2e9671c7d13 100644 (file)
@@ -34,13 +34,6 @@ class pdo_moodle_recordset extends moodle_recordset {
         return $this->fields !== false;
     }
 
-    public function rewind() {
-        $this->fields = $this->sth->fetch();
-        if ($this->fields) {
-            $this->rowCount = 0;
-        }
-    }
-
     public function valid() {
         if($this->rowCount < 0) {
             $this->rewind();
index 65d81a0e6439ca47c1f7c61ff26dc6a78a5393e3..eb2d5261766611bd5f368c4744d80e237ddff271 100644 (file)
@@ -58,10 +58,6 @@ class pgsql_native_moodle_recordset extends moodle_recordset {
         $this->current = $this->fetch_next();
     }
 
-    public function rewind() {
-        // we can not seek, sorry - let's ignore it ;-)
-    }
-
     public function valid() {
         return !empty($this->current);
     }
index a02da92b58cb86a4e568078a3c9751cb0fdf9581..071332451182d8d476316cc727a22218fe7ce49b 100644 (file)
     // of rows anyway. On a large course it will explode badly...
     //
     if ($mode===MODE_ENROLDETAILS) {
-        $userids = array();
-
-        foreach ($userlist as $user) {
-            $userids[] = $user->id;
+        if ($context->id != $frontpagectx->id) {
+            $userids = $DB->get_fieldset_sql("SELECT DISTINCT u.id $from $where $wheresearch $sort", $params,
+                                             $table->get_page_start(),  $table->get_page_size());
+        } else {
+            $userids = $DB->get_fieldset_sql("SELECT u.id $from $where $wheresearch $sort", $params,
+                                             $table->get_page_start(),  $table->get_page_size());
         }
         $userlist_extra = get_participants_extra($userids, $avoidroles, $course, $context);
-
-        // Only Oracle cannot seek backwards
-        // and must re-query...
-        $userlist->rewind();
     }
 
     if ($context->id == $frontpagectx->id) {