]> granicus.if.org Git - php/commitdiff
pgsql.php
authorTomas V.V.Cox <cox@php.net>
Mon, 26 Mar 2001 23:31:49 +0000 (23:31 +0000)
committerTomas V.V.Cox <cox@php.net>
Mon, 26 Mar 2001 23:31:49 +0000 (23:31 +0000)
* connect() always use pg_connect string instead of the deprecated params
mode
* removed duplicated functions prepare() and execute() (now in common.php)
* pgsqlRaiseError() always fills native error param on DB_error objs
* added third param $rownum to fetchInto() so users can fetch also absolute
row numbers
* changed fetchRow() to use fetchInto() (can not erase, still used in get*()
from common.php

DB.php
* added third param $rownum to fetchInto()/fetchRow() so users can fetch
also absolute row numbers
* changed fetchRow() to use fetchInto()

pear/DB.php

index 7713fd9464507a27ac8954f57f28d18e566a43fc..9f2037efd056f604ba8ba1b4681170f3f1413c7e 100644 (file)
@@ -135,7 +135,7 @@ define('DB_GETMODE_FLIPPED', DB_FETCHMODE_FLIPPED);
 /**
  * these are constants for the tableInfo-function
  * they are bitwised or'ed. so if there are more constants to be defined
- * in the future, adjust DB_TABLEINFO_FULL accordingly 
+ * in the future, adjust DB_TABLEINFO_FULL accordingly
  */
 
 define('DB_TABLEINFO_ORDER', 1);
@@ -579,29 +579,36 @@ class DB_result
     }
 
     /**
-     * Fetch and return a row of data.
+     * Fetch and return a row of data (it uses fetchInto for that)
+     * @param   $fetchmode  format of fetched row array
+     * @param   $rownum     the absolute row number to fetch
+     *
      * @return  array   a row of data, or false on error
      */
-    function fetchRow($fetchmode = DB_FETCHMODE_DEFAULT)
+    function fetchRow($fetchmode = DB_FETCHMODE_DEFAULT, $rownum=0)
     {
-        if ($fetchmode == DB_FETCHMODE_DEFAULT) {
-            $fetchmode = $this->dbh->fetchmode;
+        $res = $this->fetchInto ($arr, $fetchmode, $rownum);
+        if ($res !== DB_OK) {
+            return $res;
         }
-        return $this->dbh->fetchRow($this->result, $fetchmode);
+        return $arr;
     }
 
     /**
      * Fetch a row of data into an existing array.
      *
-     * @param   $arr    reference to data array
+     * @param   $arr                reference to data array
+     * @param   $fetchmode  format of fetched row array
+     * @param   $rownum     the absolute row number to fetch
+     *
      * @return  int     error code
      */
-    function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT)
+    function fetchInto(&$arr, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum=0)
     {
         if ($fetchmode == DB_FETCHMODE_DEFAULT) {
             $fetchmode = $this->dbh->fetchmode;
         }
-        return $this->dbh->fetchInto($this->result, $arr, $fetchmode);
+        return $this->dbh->fetchInto($this->result, $arr, $fetchmode, $rownum=0);
     }
 
     /**