summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-05 14:59:16 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-05 14:59:16 +0100
commit57bdeb61bf199d1ae3ceaede4e9a9af8290ce715 (patch)
tree9c6ff3ebd8c843296ed7af84c6952c59ee74a645
parent8af76666474c42b45518c08bec16b4f8d700dd3c (diff)
Removed oci8-specific stuff from DB_driver.php and added a constructor to DB_result to handle initialization
-rw-r--r--system/database/DB_driver.php22
-rw-r--r--system/database/DB_result.php6
-rw-r--r--system/database/drivers/oci8/oci8_result.php15
-rw-r--r--user_guide_src/source/changelog.rst2
4 files changed, 22 insertions, 23 deletions
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index e403efb9f..a61450d4c 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -77,12 +77,6 @@ class CI_DB_driver {
var $_protect_identifiers = TRUE;
var $_reserved_identifiers = array('*'); // Identifiers that should NOT be escaped
- // These are use with Oracle
- var $stmt_id;
- var $curs_id;
- var $limit_used;
-
-
/**
* Constructor. Accepts one parameter containing the database
* connection settings.
@@ -396,21 +390,9 @@ class CI_DB_driver {
}
// Load and instantiate the result driver
+ $driver = $this->load_rdriver();
+ $RES = new $driver($this);
- $driver = $this->load_rdriver();
- $RES = new $driver();
- $RES->conn_id = $this->conn_id;
- $RES->result_id = $this->result_id;
-
- if ($this->dbdriver == 'oci8')
- {
- $RES->stmt_id = $this->stmt_id;
- $RES->curs_id = NULL;
- $RES->limit_used = $this->limit_used;
- $this->stmt_id = FALSE;
- }
-
- // oci8 vars must be set before calling this
$RES->num_rows = $RES->num_rows();
// Is query caching enabled? If so, we'll serialize the
diff --git a/system/database/DB_result.php b/system/database/DB_result.php
index 730443222..61aa56121 100644
--- a/system/database/DB_result.php
+++ b/system/database/DB_result.php
@@ -47,6 +47,12 @@ class CI_DB_result {
public $num_rows = 0;
public $row_data = NULL;
+ public function __construct(&$driver_object)
+ {
+ $this->conn_id = $driver_object->conn_id;
+ $this->result_id = $driver_object->result_id;
+ }
+
/**
* Query result. Acts as a wrapper function for the following functions.
*
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 0f69fa9ef..383b9f1a0 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -38,9 +38,18 @@
*/
class CI_DB_oci8_result extends CI_DB_result {
- var $stmt_id;
- var $curs_id;
- var $limit_used;
+ public $stmt_id;
+ public $curs_id;
+ public $limit_used;
+
+ public function __construct(&$driver_object)
+ {
+ parent::__construct($driver_object);
+ $this->stmt_id = $driver_object->stmt_id;
+ $this->curs_id = $driver_object->curs_id;
+ $this->limit_used = $driver_object->limit_used;
+ $driver_object->stmt_id = FALSE;
+ }
/**
* Number of rows in the result set.
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 0de85a46b..533746065 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -62,6 +62,7 @@ Release Date: Not Released
- pg_version() is now used to get the database version number, when possible.
- Added db_set_charset() support.
- Added _optimize_table() support for the :doc:`Database Utility Class <database/utilities>` (rebuilds table indexes).
+ - Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the base DB_driver class to allow better abstraction.
- Libraries
@@ -138,6 +139,7 @@ Bug fixes for 3.0
- Fixed a bug (#1080) - When using the SMTP protocol, the :doc:`Email Library <libraries/email>` send() method was returning TRUE even if the connection/authentication against the server failed.
- Fixed a bug (#499) - a CSRF cookie was created even with CSRF protection being disabled.
- Fixed a bug (#306) - ODBC's insert_id() method was calling non-existent function odbc_insert_id(), which resulted in a fatal error.
+- Fixed a bug in Oracle's DB_result class where the cursor id passed to it was always NULL.
Version 2.1.1
=============