From 88d526ec5b0759e63b88320f3433826850f85ca9 Mon Sep 17 00:00:00 2001 From: "Tomas V.V.Cox" Date: Mon, 26 Mar 2001 23:31:49 +0000 Subject: [PATCH] pgsql.php * 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 | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pear/DB.php b/pear/DB.php index 7713fd9464..9f2037efd0 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -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); } /** -- 2.50.1