1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
5
* An open source application development framework for PHP 4.3.2 or newer
8
* @author ExpressionEngine Dev Team
9
* @copyright Copyright (c) 2008 - 2009, 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_odbc_result extends CI_DB_result {
30
* Number of rows in the result set
37
return @odbc_num_rows($this->result_id);
40
// --------------------------------------------------------------------
43
* Number of fields in the result set
50
return @odbc_num_fields($this->result_id);
53
// --------------------------------------------------------------------
58
* Generates an array of column names
63
function list_fields()
65
$field_names = array();
66
for ($i = 0; $i < $this->num_fields(); $i++)
68
$field_names[] = odbc_field_name($this->result_id, $i);
74
// --------------------------------------------------------------------
79
* Generates an array of objects containing field meta-data
87
for ($i = 0; $i < $this->num_fields(); $i++)
90
$F->name = odbc_field_name($this->result_id, $i);
91
$F->type = odbc_field_type($this->result_id, $i);
92
$F->max_length = odbc_field_len($this->result_id, $i);
102
// --------------------------------------------------------------------
109
function free_result()
111
if (is_resource($this->result_id))
113
odbc_free_result($this->result_id);
114
$this->result_id = FALSE;
118
// --------------------------------------------------------------------
123
* Moves the internal pointer to the desired offset. We call
124
* this internally before fetching results to make sure the
125
* result set starts at zero
130
function _data_seek($n = 0)
135
// --------------------------------------------------------------------
138
* Result - associative array
140
* Returns the result set as an array
145
function _fetch_assoc()
147
if (function_exists('odbc_fetch_object'))
149
return odbc_fetch_array($this->result_id);
153
return $this->_odbc_fetch_array($this->result_id);
157
// --------------------------------------------------------------------
162
* Returns the result set as an object
167
function _fetch_object()
169
if (function_exists('odbc_fetch_object'))
171
return odbc_fetch_object($this->result_id);
175
return $this->_odbc_fetch_object($this->result_id);
183
* subsititutes the odbc_fetch_object function when
184
* not available (odbc_fetch_object requires unixODBC)
189
function _odbc_fetch_object(& $odbc_result) {
192
if (odbc_fetch_into($odbc_result, $rs)) {
193
foreach ($rs as $k=>$v) {
194
$field_name= odbc_field_name($odbc_result, $k+1);
195
$rs_obj->$field_name = $v;
205
* subsititutes the odbc_fetch_array function when
206
* not available (odbc_fetch_array requires unixODBC)
211
function _odbc_fetch_array(& $odbc_result) {
214
if (odbc_fetch_into($odbc_result, $rs)) {
216
foreach ($rs as $k=>$v) {
217
$field_name= odbc_field_name($odbc_result, $k+1);
218
$rs_assoc[$field_name] = $v;
227
/* End of file odbc_result.php */
228
/* Location: ./system/database/drivers/odbc/odbc_result.php */
b'\\ No newline at end of file'