diff options
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/drivers/oci8/oci8_driver.php | 32 | ||||
-rw-r--r-- | system/database/drivers/oci8/oci8_result.php | 30 |
2 files changed, 24 insertions, 38 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php index d54624eda..d32c5f3d6 100644 --- a/system/database/drivers/oci8/oci8_driver.php +++ b/system/database/drivers/oci8/oci8_driver.php @@ -69,13 +69,6 @@ class CI_DB_oci8_driver extends CI_DB { public $dbdriver = 'oci8'; /** - * Statement ID - * - * @var resource - */ - public $stmt_id; - - /** * Commit mode flag * * @var int @@ -262,9 +255,14 @@ class CI_DB_oci8_driver extends CI_DB { /* Oracle must parse the query before it is run. All of the actions with * the query are based on the statement id returned by oci_parse(). */ - $this->stmt_id = oci_parse($this->conn_id, $sql); - oci_set_prefetch($this->stmt_id, 1000); - return oci_execute($this->stmt_id, $this->commit_mode); + $this->result_id = oci_parse($this->conn_id, $sql); + oci_set_prefetch($this->result_id, 1000); + if (oci_execute($this->result_id, $this->commit_mode)) + { + return $this->result_id; + } + + return FALSE; } // -------------------------------------------------------------------- @@ -277,7 +275,7 @@ class CI_DB_oci8_driver extends CI_DB { */ protected function _bind_params($params) { - if ( ! is_array($params) OR ! is_resource($this->stmt_id)) + if ( ! is_array($params) OR ! is_resource($this->result_id)) { return; } @@ -292,7 +290,7 @@ class CI_DB_oci8_driver extends CI_DB { } } - oci_bind_by_name($this->stmt_id, $param['name'], $param['value'], $param['length'], $param['type']); + oci_bind_by_name($this->result_id, $param['name'], $param['value'], $param['length'], $param['type']); } } @@ -345,7 +343,7 @@ class CI_DB_oci8_driver extends CI_DB { */ public function affected_rows() { - return oci_num_rows($this->stmt_id); + return oci_num_rows($this->result_id); } // -------------------------------------------------------------------- @@ -481,9 +479,9 @@ class CI_DB_oci8_driver extends CI_DB { // oci_error() returns an array that already contains // 'code' and 'message' keys, but it can return false // if there was no error .... - if (is_resource($this->stmt_id)) + if (is_resource($this->result_id)) { - $error = oci_error($this->stmt_id); + $error = oci_error($this->result_id); } elseif (is_resource($this->conn_id)) { @@ -597,9 +595,9 @@ class CI_DB_oci8_driver extends CI_DB { */ protected function _close() { - if (is_resource($this->stmt_id)) + if (is_resource($this->result_id)) { - oci_free_statement($this->stmt_id); + oci_free_statement($this->result_id); } oci_close($this->conn_id); diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php index 99d3d1067..cf0b33d26 100644 --- a/system/database/drivers/oci8/oci8_result.php +++ b/system/database/drivers/oci8/oci8_result.php @@ -49,13 +49,6 @@ defined('BASEPATH') OR exit('No direct script access allowed'); class CI_DB_oci8_result extends CI_DB_result { /** - * Statement ID - * - * @var resource - */ - public $stmt_id; - - /** * Limit used flag * * @var bool @@ -81,10 +74,10 @@ class CI_DB_oci8_result extends CI_DB_result { { parent::__construct($driver_object); - $this->stmt_id = $driver_object->stmt_id; + $this->result_id = $driver_object->result_id; $this->limit_used = $driver_object->limit_used; $this->commit_mode =& $driver_object->commit_mode; - $driver_object->stmt_id = FALSE; + $driver_object->result_id = FALSE; } // -------------------------------------------------------------------- @@ -96,7 +89,7 @@ class CI_DB_oci8_result extends CI_DB_result { */ public function num_fields() { - $count = oci_num_fields($this->stmt_id); + $count = oci_num_fields($this->result_id); // if we used a limit we subtract it return ($this->limit_used) ? $count - 1 : $count; @@ -116,7 +109,7 @@ class CI_DB_oci8_result extends CI_DB_result { $field_names = array(); for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) { - $field_names[] = oci_field_name($this->stmt_id, $c); + $field_names[] = oci_field_name($this->result_id, $c); } return $field_names; } @@ -136,9 +129,9 @@ class CI_DB_oci8_result extends CI_DB_result { for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++) { $F = new stdClass(); - $F->name = oci_field_name($this->stmt_id, $c); - $F->type = oci_field_type($this->stmt_id, $c); - $F->max_length = oci_field_size($this->stmt_id, $c); + $F->name = oci_field_name($this->result_id, $c); + $F->type = oci_field_type($this->result_id, $c); + $F->max_length = oci_field_size($this->result_id, $c); $retval[] = $F; } @@ -160,11 +153,6 @@ class CI_DB_oci8_result extends CI_DB_result { oci_free_statement($this->result_id); $this->result_id = FALSE; } - - if (is_resource($this->stmt_id)) - { - oci_free_statement($this->stmt_id); - } } // -------------------------------------------------------------------- @@ -178,7 +166,7 @@ class CI_DB_oci8_result extends CI_DB_result { */ protected function _fetch_assoc() { - return oci_fetch_assoc($this->stmt_id); + return oci_fetch_assoc($this->result_id); } // -------------------------------------------------------------------- @@ -193,7 +181,7 @@ class CI_DB_oci8_result extends CI_DB_result { */ protected function _fetch_object($class_name = 'stdClass') { - $row = oci_fetch_object($this->stmt_id); + $row = oci_fetch_object($this->result_id); if ($class_name === 'stdClass' OR ! $row) { |