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 if ($this->curs_id)
00048 {
00049 @ociexecute($this->curs_id);
00050 }
00051 return $rowcount;
00052 }
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 function num_fields()
00063 {
00064 $count = @ocinumcols($this->stmt_id);
00065
00066
00067 if ($this->limit_used)
00068 {
00069 $count = $count - 1;
00070 }
00071
00072 return $count;
00073 }
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 function list_fields()
00086 {
00087 $field_names = array();
00088 $fieldCount = $this->num_fields();
00089 for ($c = 1; $c <= $fieldCount; $c++)
00090 {
00091 $field_names[] = ocicolumnname($this->stmt_id, $c);
00092 }
00093 return $field_names;
00094 }
00095
00096
00097 function field_names()
00098 {
00099 return $this->list_fields();
00100 }
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 function field_data()
00113 {
00114 $retval = array();
00115 $fieldCount = $this->num_fields();
00116 for ($c = 1; $c <= $fieldCount; $c++)
00117 {
00118 $F = new stdClass();
00119 $F->name = ocicolumnname($this->stmt_id, $c);
00120 $F->type = ocicolumntype($this->stmt_id, $c);
00121 $F->max_length = ocicolumnsize($this->stmt_id, $c);
00122
00123 $retval[] = $F;
00124 }
00125
00126 return $retval;
00127 }
00128
00129
00130
00131
00132
00133
00134
00135
00136 function free_result()
00137 {
00138 if (is_resource($this->result_id))
00139 {
00140 ocifreestatement($this->result_id);
00141 $this->result_id = FALSE;
00142 }
00143 }
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155 function _fetch_assoc(&$row)
00156 {
00157 $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
00158
00159 return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);
00160 }
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 function _fetch_object()
00173 {
00174 $result = array();
00175
00176
00177 if (function_exists('oci_fetch_object'))
00178 {
00179 $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
00180
00181 return @oci_fetch_object($id);
00182 }
00183
00184
00185 foreach ($this->result_array() as $key => $val)
00186 {
00187 $obj = new stdClass();
00188 if (is_array($val))
00189 {
00190 foreach ($val as $k => $v)
00191 {
00192 $obj->$k = $v;
00193 }
00194 }
00195 else
00196 {
00197 $obj->$key = $val;
00198 }
00199
00200 $result[] = $obj;
00201 }
00202
00203 return $result;
00204 }
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214 function result_array()
00215 {
00216 if (count($this->result_array) > 0)
00217 {
00218 return $this->result_array;
00219 }
00220
00221
00222
00223 $row = NULL;
00224 while ($this->_fetch_assoc($row))
00225 {
00226 $this->result_array[] = $row;
00227 }
00228
00229 return $this->result_array;
00230 }
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244 function _data_seek($n = 0)
00245 {
00246 return FALSE;
00247 }
00248
00249 }
00250
00251
00252
00253