Add fetch() method compatible with PDO fetch() methods
authorChuck Hagenbuch <chuck@horde.org>
Mon, 13 Apr 2009 03:33:48 +0000 (23:33 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Mon, 13 Apr 2009 03:33:48 +0000 (23:33 -0400)
framework/Db/lib/Horde/Db/Adapter/Mysqli/Result.php

index 7a64197..c6b85ee 100644 (file)
@@ -168,6 +168,19 @@ class Horde_Db_Adapter_Mysqli_Result implements Iterator
     }
 
     /**
+     * Return the current row and advance the recordset one row.
+     */
+    public function fetch()
+    {
+        if (!$this->valid()) {
+            return null;
+        }
+        $row = $this->current();
+        $this->next();
+        return $row;
+    }
+
+    /**
      * Implementation of the valid() method for iterator
      *
      * @return boolean Whether the iteration is valid