cvs: pear /MDB pgsql.php

From: Date: Thu, 20 Jun 2002 12:41:43 +0000
Subject: cvs: pear /MDB pgsql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4712@lists.php.net to get a copy of this message
lsmith Thu Jun 20 08:41:43 2002 EDT Modified files: /pear/MDB pgsql.php Log: fixed fetchInto to work of no row number is supplied Index: pear/MDB/pgsql.php diff -u pear/MDB/pgsql.php:1.1 pear/MDB/pgsql.php:1.2 --- pear/MDB/pgsql.php:1.1 Thu Jun 20 08:11:37 2002 +++ pear/MDB/pgsql.php Thu Jun 20 08:41:43 2002 @@ -2,7 +2,7 @@ /* * mysql.php * - * @(#) $Header: /usr/repository/pear/MDB/pgsql.php,v 1.1 2002/06/20 12:11:37 lsmith Exp $ + * @(#) $Header: /usr/repository/pear/MDB/pgsql.php,v 1.2 2002/06/20 12:41:43 lsmith Exp $ * */ @@ -874,18 +874,22 @@ * * @return int DB_OK on success, a DB error code on failure */ - function fetchInto($result, &$array, $fetchmode = DB_FETCHMODE_DEFAULT, $row = NULL) + function fetchInto($result, &$array, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = NULL) { - $row = ($row !== null) ? $row : max($this->highest_fetched_row[$result], 0); - if ($row >= $this->numRows($result)) { - // return $this->raiseError(DB_ERROR, '', '', 'pgsql fetch: Tried to access beyond end of record set'); + if($rownum == NULL) { + ++$this->highest_fetched_row[$result]; + $rownum = $this->highest_fetched_row[$result]; + } else { + $this->highest_fetched_row[$result] = max($this->highest_fetched_row[$result], $row); + } + if ($rownum + 1 > $this->numRows($result)) { return NULL; } - $this->highest_fetched_row[$result] = max($this->highest_fetched_row[$result], $row); + $this->highest_fetched_row[$result] = max($this->highest_fetched_row[$result], $rownum); if ($fetchmode & DB_FETCHMODE_ASSOC) { - $array = @pg_fetch_array($result, $row, PGSQL_ASSOC); + $array = @pg_fetch_array($result, $rownum, PGSQL_ASSOC); } else { - $array = @pg_fetch_row($result, $row); + $array = @pg_fetch_row($result, $rownum); } if (!$array) { $err = pg_errormessage($this->connection);

« previous php.pear.cvs (#4712) next »