cvs: pear(MDB_1) /MDB/MDB pgsql.php
| From: | Lukas Smith | Date: | Tue, 09 Dec 2003 15:25:58 +0000 |
| Subject: | cvs: pear(MDB_1) /MDB/MDB pgsql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-14725@lists.php.net to get a copy of this message | ||
lsmith Tue Dec 9 10:25:58 2003 EDT
Modified files: (Branch: MDB_1)
/pear/MDB/MDB pgsql.php
Log:
performance tweak to MDB_pgsql::fetchInto()
Index: pear/MDB/MDB/pgsql.php
diff -u pear/MDB/MDB/pgsql.php:1.62.4.9 pear/MDB/MDB/pgsql.php:1.62.4.10
--- pear/MDB/MDB/pgsql.php:1.62.4.9 Sat Nov 1 06:04:35 2003
+++ pear/MDB/MDB/pgsql.php Tue Dec 9 10:25:58 2003
@@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
-// $Id: pgsql.php,v 1.62.4.9 2003/11/01 11:04:35 lsmith Exp $
+// $Id: pgsql.php,v 1.62.4.10 2003/12/09 15:25:58 lsmith Exp $
require_once('MDB/Common.php');
@@ -1241,32 +1241,30 @@
*/
function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = NULL)
{
+ if ($fetchmode == MDB_FETCHMODE_DEFAULT) {
+ $fetchmode = $this->fetchmode;
+ }
if ($rownum == NULL) {
++$this->highest_fetched_row[$result];
$rownum = $this->highest_fetched_row[$result];
+ if ($fetchmode & MDB_FETCHMODE_ASSOC) {
+ $array = @pg_fetch_assoc($result);
+ } else {
+ $array = @pg_fetch_row($result);
+ }
} else {
$this->highest_fetched_row[$result] = max($this->highest_fetched_row[$result],
$rownum);
- }
- if ($rownum + 1 > $this->numRows($result)) {
- return(NULL);
- }
- if ($fetchmode == MDB_FETCHMODE_DEFAULT) {
- $fetchmode = $this->fetchmode;
- }
- if ($fetchmode & MDB_FETCHMODE_ASSOC) {
- $array = @pg_fetch_array($result, $rownum, PGSQL_ASSOC);
- } else {
- $array = @pg_fetch_row($result, $rownum);
+ if ($fetchmode & MDB_FETCHMODE_ASSOC) {
+ $array = @pg_fetch_assoc($result, $rownum);
+ } else {
+ $array = @pg_fetch_row($result, $rownum);
+ }
}
if (!$array) {
- $errno = @pg_errormessage($this->connection);
- if (!$errno) {
- if ($this->options['autofree']) {
- $this->freeResult($result);
- }
- return(NULL);
+ if ($this->options['autofree']) {
+ $this->freeResult($result);
}
- return($this->pgsqlRaiseError($errno));
+ return(NULL);
}
if (isset($this->result_types[$result])) {
$array = $this->convertResultRow($result, $array);