MDL-15070 dml: recordset rewinding now forbidden - not all databases support it, sorry
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
+6
-8
@@ -531,16 +531,14 @@
|
||||
// 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) {
|
||||
|
||||
Reference in New Issue
Block a user