summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8/oci8_result.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers/oci8/oci8_result.php')
-rw-r--r--system/database/drivers/oci8/oci8_result.php61
1 files changed, 23 insertions, 38 deletions
diff --git a/system/database/drivers/oci8/oci8_result.php b/system/database/drivers/oci8/oci8_result.php
index 4312f9b21..3b042fb75 100644
--- a/system/database/drivers/oci8/oci8_result.php
+++ b/system/database/drivers/oci8/oci8_result.php
@@ -50,20 +50,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;
-
- /**
- * Cursor ID
- *
- * @var resource
- */
- public $curs_id;
-
- /**
* Limit used flag
*
* @var bool
@@ -89,11 +75,10 @@ class CI_DB_oci8_result extends CI_DB_result {
{
parent::__construct($driver_object);
- $this->stmt_id = $driver_object->stmt_id;
- $this->curs_id = $driver_object->curs_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;
}
// --------------------------------------------------------------------
@@ -105,7 +90,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;
@@ -125,7 +110,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;
}
@@ -145,9 +130,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;
}
@@ -169,17 +154,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);
- }
-
- if (is_resource($this->curs_id))
- {
- oci_cancel($this->curs_id);
- $this->curs_id = NULL;
- }
}
// --------------------------------------------------------------------
@@ -193,8 +167,7 @@ class CI_DB_oci8_result extends CI_DB_result {
*/
protected function _fetch_assoc()
{
- $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
- return oci_fetch_assoc($id);
+ return oci_fetch_assoc($this->result_id);
}
// --------------------------------------------------------------------
@@ -209,9 +182,7 @@ class CI_DB_oci8_result extends CI_DB_result {
*/
protected function _fetch_object($class_name = 'stdClass')
{
- $row = ($this->curs_id)
- ? oci_fetch_object($this->curs_id)
- : oci_fetch_object($this->stmt_id);
+ $row = oci_fetch_object($this->result_id);
if ($class_name === 'stdClass' OR ! $row)
{
@@ -227,4 +198,18 @@ class CI_DB_oci8_result extends CI_DB_result {
return $class_name;
}
+ // --------------------------------------------------------------------
+
+ /**
+ * Destructor
+ *
+ * Attempt to free remaining statement IDs.
+ *
+ * @see https://github.com/bcit-ci/CodeIgniter/pull/5896
+ * @return void
+ */
+ public function __destruct()
+ {
+ $this->free_result();
+ }
}