Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Now all the get_records() functions support only one field

to be specified in the SELECT clause. Not needed anymore to
write double "SELECT id, id..." queries. Results returned
follow exactly the same structure than normal recordsets
(first field = key) MDL-5877

Merged from MOODLE_17_STABLE
  • Loading branch information...
commit 6c279afaef444a64183f25bdd99f97ec4c3be0f2 1 parent bb5b732
stronk7 authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/dmllib.php
View
12 lib/dmllib.php
@@ -695,6 +695,18 @@ function recordset_to_array($rs) {
$objects[$key] = (object) $record; /// To object
}
return $objects;
+ /// Fallback in case we only have 1 field in the recordset. MDL-5877
+ } else if ($rs->_numOfFields == 1 && $records = $rs->GetRows()) {
+ foreach ($records as $key => $record) {
+ /// Really DIRTY HACK for Oracle, but it's the only way to make it work
+ /// until we got all those NOT NULL DEFAULT '' out from Moodle
+ if ($CFG->dbtype == 'oci8po') {
+ array_walk($record, 'onespace2empty');
+ }
+ /// End of DIRTY HACK
+ $objects[$record[$firstcolumn->name]] = (object) $record; /// The key is the first column value (like Assoc)
+ }
+ return $objects;
} else {
return false;
}
Please sign in to comment.
Something went wrong with that request. Please try again.