diff options
author | Tomas V.V.Cox <cox@php.net> | 2001-03-26 23:31:49 +0000 |
---|---|---|
committer | Tomas V.V.Cox <cox@php.net> | 2001-03-26 23:31:49 +0000 |
commit | 88d526ec5b0759e63b88320f3433826850f85ca9 (patch) | |
tree | 54b7f9839daa017319f5385de64b092aaa0d2de6 | |
parent | 6751e58f9d8551fe36ccd62556e0f21519effbba (diff) | |
download | php-git-88d526ec5b0759e63b88320f3433826850f85ca9.tar.gz |
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()
-rw-r--r-- | pear/DB.php | 25 |
1 files 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); } /** |