1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5
* An open source application development framework for PHP 5.1.6 or newer
8
* @author ExpressionEngine Dev Team
9
* @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
10
* @license http://codeigniter.com/user_guide/license.html
11
* @link http://codeigniter.com
16
// ------------------------------------------------------------------------
21
* This class extends the parent result class: CI_DB_result
24
* @author ExpressionEngine Dev Team
25
* @link http://codeigniter.com/user_guide/database/
27
class CI_DB_oci8_result extends CI_DB_result {
34
* Number of rows in the result set.
36
* Oracle doesn't have a graceful way to retun the number of rows
37
* so we have to use what amounts to a hack.
41
public function num_rows()
43
if ($this->num_rows === 0 && count($this->result_array()) > 0)
45
$this->num_rows = count($this->result_array());
46
@oci_execute($this->stmt_id);
50
@oci_execute($this->curs_id);
54
return $this->num_rows;
57
// --------------------------------------------------------------------
60
* Number of fields in the result set
65
public function num_fields()
67
$count = @oci_num_fields($this->stmt_id);
69
// if we used a limit we subtract it
70
if ($this->limit_used)
78
// --------------------------------------------------------------------
83
* Generates an array of column names
88
public function list_fields()
90
$field_names = array();
91
for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++)
93
$field_names[] = oci_field_name($this->stmt_id, $c);
98
// --------------------------------------------------------------------
103
* Generates an array of objects containing field meta-data
108
public function field_data()
111
for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++)
114
$F->name = oci_field_name($this->stmt_id, $c);
115
$F->type = oci_field_type($this->stmt_id, $c);
116
$F->max_length = oci_field_size($this->stmt_id, $c);
124
// --------------------------------------------------------------------
131
public function free_result()
133
if (is_resource($this->result_id))
135
oci_free_statement($this->result_id);
136
$this->result_id = FALSE;
140
// --------------------------------------------------------------------
143
* Result - associative array
145
* Returns the result set as an array
150
protected function _fetch_assoc()
152
$id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
153
return oci_fetch_assoc($id);
156
// --------------------------------------------------------------------
161
* Returns the result set as an object
166
protected function _fetch_object()
168
$id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
169
return @oci_fetch_object($id);
172
// --------------------------------------------------------------------
175
* Query result. "array" version.
180
public function result_array()
182
if (count($this->result_array) > 0)
184
return $this->result_array;
188
while ($row = $this->_fetch_assoc())
190
$this->result_array[] = $row;
193
return $this->result_array;
196
// --------------------------------------------------------------------
201
* Moves the internal pointer to the desired offset. We call
202
* this internally before fetching results to make sure the
203
* result set starts at zero
208
protected function _data_seek($n = 0)
210
return FALSE; // Not needed
216
/* End of file oci8_result.php */
217
/* Location: ./system/database/drivers/oci8/oci8_result.php */