cvs: pear /MDB/MDB oci8.php
| From: | Lukas Smith | Date: | Fri, 17 Jan 2003 23:04:08 +0000 |
| Subject: | cvs: pear /MDB/MDB oci8.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8352@lists.php.net to get a copy of this message | ||
lsmith Fri Jan 17 18:04:08 2003 EDT
Modified files:
/pear/MDB/MDB oci8.php
Log:
slowly making progress .. was able to send a query and get some data back
still needs some more work
Index: pear/MDB/MDB/oci8.php
diff -u pear/MDB/MDB/oci8.php:1.4 pear/MDB/MDB/oci8.php:1.5
--- pear/MDB/MDB/oci8.php:1.4 Fri Jan 17 08:23:40 2003
+++ pear/MDB/MDB/oci8.php Fri Jan 17 18:04:07 2003
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
-// $Id: oci8.php,v 1.4 2003/01/17 13:23:40 lsmith Exp $
+// $Id: oci8.php,v 1.5 2003/01/17 23:04:07 lsmith Exp $
if (!defined('MDB_OCI8_INCLUDED')) {
define('MDB_OCI8_INCLUDED', 1);
@@ -271,8 +271,14 @@
*
* @return TRUE on success, MDB_Error on failure
*/
- function connect()
+ function connect($user = NULL , $password = NULL, $persistent = 0)
{
+ if($user === NULL) {
+ $user = $this->user;
+ }
+ if($password === NULL) {
+ $password = $this->password;
+ }
if (isset($this->options["SID"])) {
$sid = $this->options["SID"];
} else {
@@ -1427,15 +1433,53 @@
* @return int data array on success, a MDB error on failure
* @access public
*/
- function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = NULL)
+ function fetchInto($result, $fetchmode = MDB_FETCHMODE_DEFAULT, $rownum = 0)
{
- if (!$this->fetchRow($result, $row)) {
+ $result_value = intval($result);
+ if(!isset($this->current_row[$result_value])) {
+ return($this->raiseError("Fetch row: attempted to fetch a row from an unknown
query result"));
+ }
+ if(isset($this->results[$result_value][$rownum])) {
return($this->raiseError());
}
+ if(isset($this->rows[$result_value])) {
+ return($this->raiseError("Fetch row: there are no more rows to
retrieve"));
+ }
+ if(isset($this->limits[$result_value])) {
+ if($rownum >= $this->limits[$result_value][1]) {
+ return($this->raiseError("Fetch row: attempted to fetch a row beyhond the
number rows available in the query result"));
+ }
+ if(!MDB::isError($this->_skipFirstRows($result))) {
+ return(MDB_OK);
+ }
+ }
+ if(isset($this->row_buffer[$result_value])) {
+ $this->current_row[$result_value]++;
+ $this->results[$result_value][$this->current_row[$result_value]] =
$this->row_buffer[$result_value];
+ unset($this->row_buffer[$result_value]);
+ }
+ for(;$this->current_row[$result_value] < $row;
+ $this->current_row[$result_value]++)
+ {
+ if ($fetchmode & MDB_FETCHMODE_ASSOC) {
+ $moredata = @OCIFetchInto($result,
$this->results[$result_value][$this->current_row[$result_value]+1],
OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS);
+ } else {
+ $moredata = @OCIFetchInto($result,
$this->results[$result_value][$this->current_row[$result_value]+1],
OCI_RETURN_NULLS+OCI_RETURN_LOBS);
+ }
+ if(!$moredata) {
+ if($this->options['autofree']) {
+ $this->freeResult($result);
+ }
+ return NULL;
+ }
+ }
$result_value = intval($result);
- $array = $this->results[$result_value][$row];
- $this->highest_fetched_row[$result_value] =
max($this->highest_fetched_row[$result_value], $row);
- return($this->convertResultRow($result, $array));
+ $array = $this->results[$result_value][$rownum];
+ $this->highest_fetched_row[$result_value] =
max($this->highest_fetched_row[$result_value], $rownum);
+ if (isset($this->result_types[$result])) {
+ $array = $this->convertResultRow($result, $array);
+ }
+ return ($array);
}
// }}}