]> git.mjollnir.org Git - moodle.git/commitdiff
Implement proper keys for adodb and pdo recordset iterators. MDL-15798
authorstronk7 <stronk7>
Mon, 28 Jul 2008 22:22:22 +0000 (22:22 +0000)
committerstronk7 <stronk7>
Mon, 28 Jul 2008 22:22:22 +0000 (22:22 +0000)
lib/dml/adodb_moodle_recordset.php
lib/dml/pdo_moodle_recordset.php

index a9776957cfdf898026ed119e4be0e570b027dceb..0b325ea734160e7d2c9891a3533bd1b3fa0ff31f 100644 (file)
@@ -19,7 +19,8 @@ class adodb_moodle_recordset extends moodle_recordset {
     }
 
     public function key() {
-        return $this->rs->_currentRow;
+    /// return first column value as key
+        return reset($this->rs->fields);
     }
 
     public function next() {
index 063a33f674180327cb04f148d3e451fff7205440..3122b7035c48c65b67bda0090e0ff008120536a6 100644 (file)
@@ -22,7 +22,8 @@ class pdo_moodle_recordset extends moodle_recordset {
     }
 
     public function key() {
-        return $this->rowCount;
+    /// return first column value as key
+        return reset($this->fields);
     }
 
     public function next() {