cvs: pear /MDB2/MDB2/Driver oci8.php
| From: | Lukas Smith | Date: | Fri, 21 May 2004 11:41:51 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver oci8.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-19725@lists.php.net to get a copy of this message | ||
lsmith Fri May 21 07:41:51 2004 EDT
Modified files:
/pear/MDB2/MDB2/Driver oci8.php
Log:
- fixed bugs in LOB and limit handling
- allow errorInfo() to be called when no connection has been established yet
- cleaned up constructor handling
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/oci8.php?r1=1.15&r2=1.16&ty=u
Index: pear/MDB2/MDB2/Driver/oci8.php
diff -u pear/MDB2/MDB2/Driver/oci8.php:1.15 pear/MDB2/MDB2/Driver/oci8.php:1.16
--- pear/MDB2/MDB2/Driver/oci8.php:1.15 Wed May 12 08:58:19 2004
+++ pear/MDB2/MDB2/Driver/oci8.php Fri May 21 07:41:51 2004
@@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@backendmedia.com> |
// +----------------------------------------------------------------------+
-// $Id: oci8.php,v 1.15 2004/05/12 12:58:19 lsmith Exp $
+// $Id: oci8.php,v 1.16 2004/05/21 11:41:51 lsmith Exp $
/**
* MDB2 OCI8 driver
@@ -65,9 +65,10 @@
/**
* Constructor
*/
- function MDB2_Driver_oci8()
+ function __construct()
{
- $this->MDB2_Driver_Common();
+ parent::__construct();
+
$this->phptype = 'oci8';
$this->dbsyntax = 'oci8';
@@ -88,10 +89,15 @@
$this->options['DBA_password'] = false;
$this->options['database_name_prefix'] = false;
$this->options['default_tablespace'] = false;
- $this->options['HOME'] = false;
+ $this->options['home'] = false;
$this->options['default_text_field_length'] = 4000;
}
+ function MDB2_Driver_oci8()
+ {
+ $this->__construct();
+ }
+
// }}}
// {{{ errorInfo()
@@ -107,8 +113,10 @@
if (is_resource($error)) {
$error_data = @OCIError($error);
$error = null;
- } else {
+ } elseif($this->connection) {
$error_data = @OCIError($this->connection);
+ } else {
+ $error_data = @OCIError();
}
$native_code = $error_data['code'];
$native_msg = $error_data['message'];
@@ -253,14 +261,14 @@
'it was not specified a valid Oracle Service Identifier (SID)');
}
- if ($this->options['HOME']) {
- putenv('ORACLE_HOME='.$this->options['HOME']);
+ if ($this->options['home']) {
+ putenv('ORACLE_HOME='.$this->options['home']);
}
putenv('ORACLE_SID='.$sid);
$function = ($persistent ? 'OCIPLogon' : 'OCINLogon');
$connection = @$function($username, $password, $sid);
if (!$connection) {
- $connection = $this->raiseError();
+ $connection = $this->raiseError(MDB2_ERROR_CONNECT_FAILED);
}
return $connection;
}
@@ -427,7 +435,7 @@
) {
$clob_stream = key($this->clobs[$prepared_query]);
$parameter = $GLOBALS['_MDB2_LOBs'][$clob_stream]->parameter;
- if (!OCIBindByName($statement, ':clob'.$parameter,
$descriptors[$clob_stream], -1, OCI_B_CLOB)) {
+ if (!OCIBindByName($statement, ':clob'.($parameter+1),
$descriptors[$clob_stream], -1, OCI_B_CLOB)) {
$success = $this->raiseError();
break;
}
@@ -439,7 +447,7 @@
) {
$blob_stream = key($this->blobs[$prepared_query]);
$parameter =
$GLOBALS['_MDB2_LOBs'][$blob_stream]->parameter;
- if (!OCIBindByName($statement, ':blob'.$parameter,
$descriptors[$blob_stream], -1, OCI_B_BLOB)) {
+ if (!OCIBindByName($statement, ':blob'.($parameter+1),
$descriptors[$blob_stream], -1, OCI_B_BLOB)) {
$success = $this->raiseError();
break;
}
@@ -702,18 +710,6 @@
class MDB2_Result_oci8 extends MDB2_Result_Common
{
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- */
- function MDB2_Result_oci8(&$mdb, &$result, $offset, $limit)
- {
- parent::MDB2_Result_Common($mdb, $result, $offset, $limit);
- }
-
- // }}}
// {{{ _skipLimitOffset()
/**
@@ -730,10 +726,11 @@
return false;
}
}
- if ($this->limit) {
- while ($this->offset_count < $this->limit) {
+ if ($this->offset) {
+ while ($this->offset_count < $this->offset) {
++$this->offset_count;
if (!@OCIFetchInto($this->result, $row, OCI_RETURN_NULLS)) {
+ $this->offset_count = $this->offset;
return false;
}
}
@@ -904,18 +901,6 @@
var $buffer;
var $buffer_rownum = - 1;
- // }}}
- // {{{ constructor
-
- /**
- * Constructor
- */
- function MDB2_BufferedResult_oci8(&$mdb, &$result, $offset, $limit)
- {
- parent::MDB2_Result_oci8($mdb, $result, $offset, $limit);
- }
-
- // }}}
// {{{ _fillBuffer()
/**