cvs: pear /MDB/MDB ibase.php oci8.php

From: Date: Wed, 24 Sep 2003 07:09:35 +0000
Subject: cvs: pear /MDB/MDB ibase.php oci8.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-13032@lists.php.net to get a copy of this message
lsmith Wed Sep 24 03:09:35 2003 EDT Modified files: /pear/MDB/MDB oci8.php ibase.php Log: - tweaks to fetchRow and numRows, especially towards improving the internal result buffering

Index: pear/MDB/MDB/oci8.php diff -u pear/MDB/MDB/oci8.php:1.59 pear/MDB/MDB/oci8.php:1.60 --- pear/MDB/MDB/oci8.php:1.59 Tue Sep 23 10:21:36 2003 +++ pear/MDB/MDB/oci8.php Wed Sep 24 03:09:34 2003 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.59 2003/09/23 14:21:36 lsmith Exp $ +// $Id: oci8.php,v 1.60 2003/09/24 07:09:34 lsmith Exp $ require_once 'MDB/Common.php'; @@ -833,15 +833,15 @@ if ($limit == 0 || $this->results[$result_value]['current_row'] + 1 < $limit) { if (isset($this->results[$result_value]['row_buffer'])) { $this->results[$result_value]['current_row']++; - $this->results[$result_value][$this->results[$result_value]['current_row']] = - $this->results[$result_value]['row_buffer']; + $row = array_change_key_case($this->results[$result_value]['row_buffer']); unset($this->results[$result_value]['row_buffer']); + $this->results[$result_value][$this->results[$result_value]['current_row']] = $row; } while (($limit == 0 || $this->results[$result_value]['current_row'] + 1 < $limit) && @OCIFetchInto($result, $row, OCI_ASSOC+OCI_RETURN_NULLS) ) { - $row = array_change_key_case($row); $this->results[$result_value]['current_row']++; + $row = array_change_key_case($row); $this->results[$result_value][$this->results[$result_value]['current_row']] = $row; } } @@ -956,6 +956,9 @@ function fetchRow($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = null) { $result_value = intval($result); + if ($fetchmode == MDB_FETCHMODE_DEFAULT) { + $fetchmode = $this->fetchmode; + } if ($this->options['result_buffering']) { if (is_null($rownum)) { $rownum = $this->results[$result_value]['highest_fetched_row'] + 1; @@ -985,14 +988,14 @@ if ($this->options['result_buffering']) { if (isset($this->results[$result_value]['row_buffer'])) { $this->results[$result_value]['current_row']++; - $this->results[$result_value][$this->results[$result_value]['current_row']] = - $this->results[$result_value]['row_buffer']; + $row = array_change_key_case($this->results[$result_value]['row_buffer']); unset($this->results[$result_value]['row_buffer']); + $this->results[$result_value][$this->results[$result_value]['current_row']] = $row; } while ($this->results[$result_value]['current_row'] < $rownum) { $this->results[$result_value]['current_row']++; $moredata = @OCIFetchInto($result, $row, OCI_ASSOC+OCI_RETURN_NULLS); - if (!$moredata) { + if (!$moredata || !is_array($row)) { return null; } $row = array_change_key_case($row); @@ -1008,7 +1011,9 @@ } else { if ($fetchmode == MDB_FETCHMODE_ASSOC) { $moredata = @OCIFetchInto($result, $row, OCI_ASSOC+OCI_RETURN_NULLS); - $row = array_change_key_case($row); + if (is_array($row)) { + $row = array_change_key_case($row); + } } else { $moredata = @OCIFetchInto($result, $row, OCI_RETURN_NULLS); } Index: pear/MDB/MDB/ibase.php diff -u pear/MDB/MDB/ibase.php:1.57 pear/MDB/MDB/ibase.php:1.58 --- pear/MDB/MDB/ibase.php:1.57 Tue Sep 23 10:21:29 2003 +++ pear/MDB/MDB/ibase.php Wed Sep 24 03:09:34 2003 @@ -42,7 +42,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.57 2003/09/23 14:21:29 lsmith Exp $ +// $Id: ibase.php,v 1.58 2003/09/24 07:09:34 lsmith Exp $ require_once 'MDB/Common.php'; @@ -703,8 +703,7 @@ return true; } } - if (is_array($row = @ibase_fetch_assoc($result))) { - $this->results[$result_value]['row_buffer'] = $row; + if (is_array($this->results[$result_value]['row_buffer'] = @ibase_fetch_assoc($result))) { return false; } unset($this->results[$result_value]['row_buffer']); @@ -764,15 +763,22 @@ if ($limit == 0 || $this->results[$result_value]['current_row'] + 1 < $limit) { if (isset($this->results[$result_value]['row_buffer'])) { $this->results[$result_value]['current_row']++; - $this->results[$result_value][$this->results[$result_value]['current_row']] = - $this->results[$result_value]['row_buffer']; + $row = $this->results[$result_value]['row_buffer']; unset($this->results[$result_value]['row_buffer']); + if (is_array($row)) { + foreach ($row as $key => $value_with_space) { + $row[strtolower($key)] = rtrim($value_with_space); + } + } + $this->results[$result_value][$this->results[$result_value]['current_row']] = $row; } while (($limit == 0 || $this->results[$result_value]['current_row'] + 1 < $limit) && (is_array($row = @ibase_fetch_assoc($result))) ) { - $row = array_change_key_case($row); $this->results[$result_value]['current_row']++; + foreach ($row as $key => $value_with_space) { + $row[strtolower($key)] = rtrim($value_with_space); + } $this->results[$result_value][$this->results[$result_value]['current_row']] = $row; } } @@ -918,6 +924,9 @@ function fetchRow($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = null) { $result_value = intval($result); + if ($fetchmode == MDB_FETCHMODE_DEFAULT) { + $fetchmode = $this->fetchmode; + } if ($this->options['result_buffering']) { if (is_null($rownum)) { $rownum = $this->results[$result_value]['highest_fetched_row'] + 1; @@ -947,46 +956,47 @@ if ($this->options['result_buffering']) { if (isset($this->results[$result_value]['row_buffer'])) { $this->results[$result_value]['current_row']++; - $this->results[$result_value][$this->results[$result_value]['current_row']] = - $this->results[$result_value]['row_buffer']; + $row = $this->results[$result_value]['row_buffer']; unset($this->results[$result_value]['row_buffer']); + if (is_array($row)) { + foreach ($row as $key => $value_with_space) { + $row[strtolower($key)] = rtrim($value_with_space); + } + } + $this->results[$result_value][$this->results[$result_value]['current_row']] = $row; } while ($this->results[$result_value]['current_row'] < $rownum) { $this->results[$result_value]['current_row']++; $row = @ibase_fetch_assoc($result); - if (!$row) { + if (!is_array($row)) { return null; } - $row = array_change_key_case($row); - //NOT SURE IF REALLY OK... basically it doesn't process $row if it's false - if (is_array($row)) { - foreach ($row as $key => $value_with_space) { - $row[$key] = strtolower(rtrim($value_with_space)); - } + foreach ($row as $key => $value_with_space) { + $row[strtolower($key)] = rtrim($value_with_space); } $this->results[$result_value][$this->results[$result_value]['current_row']] = $row; } if ($fetchmode == MDB_FETCHMODE_ASSOC) { - $row = $this->results[$result_value][$rownum]; + $row = $row; } else { - $row = array_values($this->results[$result_value][$rownum]); + $row = array_values($row); } $this->results[$result_value]['highest_fetched_row'] = max($this->results[$result_value]['highest_fetched_row'], $rownum); } else { if ($fetchmode == MDB_FETCHMODE_ASSOC) { $row = @ibase_fetch_assoc($result); + if (is_array($row)) { + $row = array_change_key_case($row); + } } else { $row = @ibase_fetch_row($result); } - if (!$row) { + if (!is_array($row)) { return null; } - $row = array_change_key_case($row); - if (is_array($row)) { - foreach ($row as $key => $value_with_space) { - $row[$key] = rtrim($value_with_space); - } + foreach ($row as $key => $value_with_space) { + $row[$key] = rtrim($value_with_space); } } if (isset($this->results[$result_value]['types'])) {
« previous php.pear.cvs (#13032) next »