Skip to content

Commit

Permalink
MDL-15070 dml: recordset rewinding now forbidden - not all databases …
Browse files Browse the repository at this point in the history
…support it, sorry
  • Loading branch information
skodak committed Oct 28, 2008
1 parent 7063c80 commit d669160
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 29 deletions.
4 changes: 0 additions & 4 deletions lib/dml/adodb_moodle_recordset.php
Expand Up @@ -27,10 +27,6 @@ public function next() {
$this->rs->MoveNext();
}

public function rewind() {
$this->rs->MoveFirst();
}

public function valid() {
return !$this->rs->EOF;
}
Expand Down
7 changes: 5 additions & 2 deletions lib/dml/moodle_recordset.php
Expand Up @@ -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?
Expand Down
4 changes: 0 additions & 4 deletions lib/dml/mysqli_native_moodle_recordset.php
Expand Up @@ -40,10 +40,6 @@ public function next() {
$this->current = $this->fetch_next();
}

public function rewind() {
// we can not seek, sorry - let's ignore it ;-)
}

public function valid() {
return !empty($this->current);
}
Expand Down
7 changes: 0 additions & 7 deletions lib/dml/pdo_moodle_recordset.php
Expand Up @@ -34,13 +34,6 @@ public function next() {
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();
Expand Down
4 changes: 0 additions & 4 deletions lib/dml/pgsql_native_moodle_recordset.php
Expand Up @@ -58,10 +58,6 @@ public function next() {
$this->current = $this->fetch_next();
}

public function rewind() {
// we can not seek, sorry - let's ignore it ;-)
}

public function valid() {
return !empty($this->current);
}
Expand Down
14 changes: 6 additions & 8 deletions user/index.php
Expand Up @@ -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) {
Expand Down

0 comments on commit d669160

Please sign in to comment.