]>
jfr.im git - z_archive/KronOS.git/blob - system/database/drivers/mysqli/mysqli_result.php
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_mysqli_result
extends CI_DB_result
{
30 * Number of rows in the result set
37 return @mysqli_num_rows($this->result_id
);
40 // --------------------------------------------------------------------
43 * Number of fields in the result set
50 return @mysqli_num_fields($this->result_id
);
53 // --------------------------------------------------------------------
58 * Generates an array of column names
63 function list_fields()
65 $field_names = array();
66 while ($field = mysqli_fetch_field($this->result_id
))
68 $field_names[] = $field->name
;
74 // --------------------------------------------------------------------
79 * Generates an array of objects containing field meta-data
87 while ($field = mysqli_fetch_object($this->result_id
))
89 preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type
, $matches);
91 $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL;
92 $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL;
95 $F->name
= $field->Field
;
97 $F->default = $field->Default;
98 $F->max_length
= $length;
99 $F->primary_key
= ( $field->Key
== 'PRI' ? 1 : 0 );
107 // --------------------------------------------------------------------
114 function free_result()
116 if (is_object($this->result_id
))
118 mysqli_free_result($this->result_id
);
119 $this->result_id
= FALSE;
123 // --------------------------------------------------------------------
128 * Moves the internal pointer to the desired offset. We call
129 * this internally before fetching results to make sure the
130 * result set starts at zero
135 function _data_seek($n = 0)
137 return mysqli_data_seek($this->result_id
, $n);
140 // --------------------------------------------------------------------
143 * Result - associative array
145 * Returns the result set as an array
150 function _fetch_assoc()
152 return mysqli_fetch_assoc($this->result_id
);
155 // --------------------------------------------------------------------
160 * Returns the result set as an object
165 function _fetch_object()
167 return mysqli_fetch_object($this->result_id
);
173 /* End of file mysqli_result.php */
174 /* Location: ./system/database/drivers/mysqli/mysqli_result.php */