oci8_result.php
Go to the documentation of this file.00001 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class CI_DB_oci8_result extends CI_DB_result {
00028
00029 var $stmt_id;
00030 var $curs_id;
00031 var $limit_used;
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 function num_rows()
00044 {
00045 $rowcount = count($this->result_array());
00046 @ociexecute($this->stmt_id);
00047
00048 if ($this->curs_id)
00049 {
00050 @ociexecute($this->curs_id);
00051 }
00052
00053 return $rowcount;
00054 }
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 function num_fields()
00065 {
00066 $count = @ocinumcols($this->stmt_id);
00067
00068
00069 if ($this->limit_used)
00070 {
00071 $count = $count - 1;
00072 }
00073
00074 return $count;
00075 }
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 function list_fields()
00088 {
00089 $field_names = array();
00090 $fieldCount = $this->num_fields();
00091 for ($c = 1; $c <= $fieldCount; $c++)
00092 {
00093 $field_names[] = ocicolumnname($this->stmt_id, $c);
00094 }
00095 return $field_names;
00096 }
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 function field_data()
00109 {
00110 $retval = array();
00111 $fieldCount = $this->num_fields();
00112 for ($c = 1; $c <= $fieldCount; $c++)
00113 {
00114 $F = new stdClass();
00115 $F->name = ocicolumnname($this->stmt_id, $c);
00116 $F->type = ocicolumntype($this->stmt_id, $c);
00117 $F->max_length = ocicolumnsize($this->stmt_id, $c);
00118
00119 $retval[] = $F;
00120 }
00121
00122 return $retval;
00123 }
00124
00125
00126
00127
00128
00129
00130
00131
00132 function free_result()
00133 {
00134 if (is_resource($this->result_id))
00135 {
00136 ocifreestatement($this->result_id);
00137 $this->result_id = FALSE;
00138 }
00139 }
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 function _fetch_assoc(&$row)
00152 {
00153 $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
00154
00155 return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
00156 }
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 function _fetch_object()
00169 {
00170 $result = array();
00171
00172
00173 if (function_exists('oci_fetch_object'))
00174 {
00175 $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
00176
00177 return @oci_fetch_object($id);
00178 }
00179
00180
00181 foreach ($this->result_array() as $key => $val)
00182 {
00183 $obj = new stdClass();
00184 if (is_array($val))
00185 {
00186 foreach ($val as $k => $v)
00187 {
00188 $obj->$k = $v;
00189 }
00190 }
00191 else
00192 {
00193 $obj->$key = $val;
00194 }
00195
00196 $result[] = $obj;
00197 }
00198
00199 return $result;
00200 }
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 function result_array()
00211 {
00212 if (count($this->result_array) > 0)
00213 {
00214 return $this->result_array;
00215 }
00216
00217
00218
00219 $row = NULL;
00220 while ($this->_fetch_assoc($row))
00221 {
00222 $this->result_array[] = $row;
00223 }
00224
00225 return $this->result_array;
00226 }
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240 function _data_seek($n = 0)
00241 {
00242 return FALSE;
00243 }
00244
00245 }
00246
00247
00248
00249