blob: 76093f91852993c32c501d81907861b3af9dc36e [file] [log] [blame]
Andrey Andreev24276a32012-01-08 02:44:38 +02001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreev24276a32012-01-08 02:44:38 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreev24276a32012-01-08 02:44:38 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
Derek Allard2067d1a2008-11-13 22:59:24 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Derek Allard2067d1a2008-11-13 22:59:24 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
27
Derek Allard2067d1a2008-11-13 22:59:24 +000028/**
29 * Database Result Class
30 *
31 * This is the platform-independent result class.
32 * This class will not be called directly. Rather, the adapter
33 * class for the specific database will extend and instantiate it.
34 *
35 * @category Database
Derek Jonesf4a4bd82011-10-20 12:18:42 -050036 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000037 * @link http://codeigniter.com/user_guide/database/
38 */
Andrey Andreev6dd4aff2012-03-20 15:54:23 +020039class CI_DB_result {
Derek Allard2067d1a2008-11-13 22:59:24 +000040
Andrey Andreev5ca05132012-07-05 12:06:34 +030041 public $conn_id;
42 public $result_id;
Andrey Andreev24276a32012-01-08 02:44:38 +020043 public $result_array = array();
44 public $result_object = array();
45 public $custom_result_object = array();
46 public $current_row = 0;
Andrey Andreev5ca05132012-07-05 12:06:34 +030047 public $num_rows;
48 public $row_data;
Derek Allard2067d1a2008-11-13 22:59:24 +000049
Andrey Andreev5ca05132012-07-05 12:06:34 +030050 /**
51 * Constructor
52 *
53 * @param object
54 * @return void
55 */
Andrey Andreev57bdeb62012-03-05 15:59:16 +020056 public function __construct(&$driver_object)
57 {
58 $this->conn_id = $driver_object->conn_id;
59 $this->result_id = $driver_object->result_id;
60 }
61
Andrey Andreev5ca05132012-07-05 12:06:34 +030062 // --------------------------------------------------------------------
63
Derek Allard2067d1a2008-11-13 22:59:24 +000064 /**
Andrey Andreev5ca05132012-07-05 12:06:34 +030065 * Number of rows in the result set
Derek Allard2067d1a2008-11-13 22:59:24 +000066 *
Andrey Andreev5ca05132012-07-05 12:06:34 +030067 * @return int
68 */
69 public function num_rows()
70 {
Andrey Andreevc7db6bb2012-07-05 15:11:20 +030071 if (is_int($this->num_rows))
72 {
73 return $this->num_rows;
74 }
75 elseif (count($this->result_array) > 0)
76 {
77 return $this->num_rows = count($this->result_array);
78 }
79 elseif (count($this->result_object) > 0)
80 {
81 return $this->num_rows = count($this->result_object);
82 }
83
84 return $this->num_rows = count($this->result_array());
Andrey Andreev5ca05132012-07-05 12:06:34 +030085 }
86
87 // --------------------------------------------------------------------
88
89 /**
90 * Query result. Acts as a wrapper function for the following functions.
91 *
92 * @param string 'object', 'array' or a custom class name
93 * @return array
Barry Mienydd671972010-10-04 16:33:58 +020094 */
Andrey Andreevbc95e472011-10-20 09:44:48 +030095 public function result($type = 'object')
Barry Mienydd671972010-10-04 16:33:58 +020096 {
Andrey Andreev5ca05132012-07-05 12:06:34 +030097 if ($type === 'array')
98 {
99 return $this->result_array();
100 }
101 elseif ($type === 'object')
102 {
103 return $this->result_object();
104 }
105 else
106 {
107 return $this->custom_result_object($type);
108 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000109 }
110
111 // --------------------------------------------------------------------
112
Greg Akere70e92b2011-04-25 10:50:53 -0500113 /**
114 * Custom query result.
115 *
Andrey Andreev24276a32012-01-08 02:44:38 +0200116 * @param string A string that represents the type of object you want back
117 * @return array of objects
Greg Akere70e92b2011-04-25 10:50:53 -0500118 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300119 public function custom_result_object($class_name)
Greg Akere70e92b2011-04-25 10:50:53 -0500120 {
Andrey Andreev4763c132012-07-05 13:58:18 +0300121 if (isset($this->custom_result_object[$class_name]))
Greg Akere70e92b2011-04-25 10:50:53 -0500122 {
123 return $this->custom_result_object[$class_name];
124 }
Andrey Andreev4763c132012-07-05 13:58:18 +0300125 elseif ( ! $this->result_id OR $this->num_rows === 0)
Greg Akere70e92b2011-04-25 10:50:53 -0500126 {
127 return array();
128 }
Razican114ab092011-04-25 17:26:45 +0200129
Andrey Andreev4763c132012-07-05 13:58:18 +0300130 // Don't fetch the result set again if we already have it
131 $_data = NULL;
132 if (($c = count($this->result_array)) > 0)
133 {
134 $_data = 'result_array';
135 }
136 elseif (($c = count($this->result_object)) > 0)
137 {
138 $_data = 'result_object';
139 }
140
141 if ($_data !== NULL)
142 {
143 for ($i = 0; $i < $c; $i++)
144 {
145 $this->custom_result_object[$class_name][$i] = new $class_name();
146
Andrey Andreev0db81b62012-07-08 22:00:17 +0300147 foreach ($this->{$_data}[$i] as $key => $value)
Andrey Andreev4763c132012-07-05 13:58:18 +0300148 {
149 $this->custom_result_object[$class_name][$i]->$key = $value;
150 }
151 }
152
153 return $this->custom_result_object[$class_name];
154 }
155
Greg Akere70e92b2011-04-25 10:50:53 -0500156 $this->_data_seek(0);
Andrey Andreev4763c132012-07-05 13:58:18 +0300157 $this->custom_result_object[$class_name] = array();
Greg Akere70e92b2011-04-25 10:50:53 -0500158
Andrey Andreev9a4f3562012-07-06 11:57:37 +0300159 while ($row = $this->_fetch_object($class_name))
Greg Akere70e92b2011-04-25 10:50:53 -0500160 {
Jon Ellis-Jonesc4efbdc2012-07-07 10:30:29 +0100161 $this->custom_result_object[$class_name][] = $row;
John Crepezzi7b474302011-01-15 18:17:01 -0500162 }
163
Andrey Andreev4763c132012-07-05 13:58:18 +0300164 return $this->custom_result_object[$class_name];
Greg Akere70e92b2011-04-25 10:50:53 -0500165 }
166
167 // --------------------------------------------------------------------
John Crepezzi7b474302011-01-15 18:17:01 -0500168
Derek Allard2067d1a2008-11-13 22:59:24 +0000169 /**
Andrey Andreev38b2a252012-03-29 11:35:32 +0300170 * Query result. "object" version.
Derek Allard2067d1a2008-11-13 22:59:24 +0000171 *
Andrey Andreev38b2a252012-03-29 11:35:32 +0300172 * @return array
Barry Mienydd671972010-10-04 16:33:58 +0200173 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300174 public function result_object()
Derek Allard2067d1a2008-11-13 22:59:24 +0000175 {
176 if (count($this->result_object) > 0)
177 {
178 return $this->result_object;
179 }
Barry Mienydd671972010-10-04 16:33:58 +0200180
Andrey Andreev4763c132012-07-05 13:58:18 +0300181 // In the event that query caching is on, the result_id variable
182 // will not be a valid resource so we'll simply return an empty
183 // array.
184 if ( ! $this->result_id OR $this->num_rows === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000185 {
186 return array();
187 }
188
Andrey Andreev4763c132012-07-05 13:58:18 +0300189 if (($c = count($this->result_array)) > 0)
190 {
191 for ($i = 0; $i < $c; $i++)
192 {
193 $this->result_object[$i] = (object) $this->result_array[$i];
194 }
195
196 return $this->result_object;
197 }
198
Derek Allard2067d1a2008-11-13 22:59:24 +0000199 $this->_data_seek(0);
200 while ($row = $this->_fetch_object())
201 {
202 $this->result_object[] = $row;
203 }
Barry Mienydd671972010-10-04 16:33:58 +0200204
Derek Allard2067d1a2008-11-13 22:59:24 +0000205 return $this->result_object;
206 }
Barry Mienydd671972010-10-04 16:33:58 +0200207
Derek Allard2067d1a2008-11-13 22:59:24 +0000208 // --------------------------------------------------------------------
209
210 /**
Andrey Andreev5ca05132012-07-05 12:06:34 +0300211 * Query result. "array" version.
Derek Allard2067d1a2008-11-13 22:59:24 +0000212 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000213 * @return array
Barry Mienydd671972010-10-04 16:33:58 +0200214 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300215 public function result_array()
Derek Allard2067d1a2008-11-13 22:59:24 +0000216 {
217 if (count($this->result_array) > 0)
218 {
219 return $this->result_array;
220 }
221
Andrey Andreev4763c132012-07-05 13:58:18 +0300222 // In the event that query caching is on, the result_id variable
223 // will not be a valid resource so we'll simply return an empty
224 // array.
225 if ( ! $this->result_id OR $this->num_rows === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000226 {
227 return array();
228 }
229
Andrey Andreev4763c132012-07-05 13:58:18 +0300230 if (($c = count($this->result_object)) > 0)
231 {
232 for ($i = 0; $i < $c; $i++)
233 {
234 $this->result_array[$i] = (array) $this->result_object[$i];
235 }
236
237 return $this->result_array;
238 }
239
Derek Allard2067d1a2008-11-13 22:59:24 +0000240 $this->_data_seek(0);
241 while ($row = $this->_fetch_assoc())
242 {
243 $this->result_array[] = $row;
244 }
Barry Mienydd671972010-10-04 16:33:58 +0200245
Derek Allard2067d1a2008-11-13 22:59:24 +0000246 return $this->result_array;
247 }
248
249 // --------------------------------------------------------------------
250
251 /**
Derek Jones37f4b9c2011-07-01 17:56:50 -0500252 * Query result. Acts as a wrapper function for the following functions.
Derek Allard2067d1a2008-11-13 22:59:24 +0000253 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300254 * @param mixed $n = 0
255 * @param string $type = 'object' 'object' or 'array'
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300256 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200257 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300258 public function row($n = 0, $type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000259 {
260 if ( ! is_numeric($n))
261 {
262 // We cache the row data for subsequent uses
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300263 is_array($this->row_data) OR $this->row_data = $this->row_array(0);
264
265 // array_key_exists() instead of isset() to allow for NULL values
266 if (empty($this->row_data) OR ! array_key_exists($n, $this->row_data))
Derek Allard2067d1a2008-11-13 22:59:24 +0000267 {
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300268 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000269 }
Barry Mienydd671972010-10-04 16:33:58 +0200270
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300271 return $this->row_data[$n];
Derek Allard2067d1a2008-11-13 22:59:24 +0000272 }
Barry Mienydd671972010-10-04 16:33:58 +0200273
Andrey Andreev24276a32012-01-08 02:44:38 +0200274 if ($type === 'object') return $this->row_object($n);
275 elseif ($type === 'array') return $this->row_array($n);
Greg Akere70e92b2011-04-25 10:50:53 -0500276 else return $this->custom_row_object($n, $type);
Derek Allard2067d1a2008-11-13 22:59:24 +0000277 }
278
279 // --------------------------------------------------------------------
280
281 /**
282 * Assigns an item into a particular column slot
283 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300284 * @param mixed $key
285 * @param mixed $value
Andrey Andreev24276a32012-01-08 02:44:38 +0200286 * @return void
Barry Mienydd671972010-10-04 16:33:58 +0200287 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300288 public function set_row($key, $value = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000289 {
290 // We cache the row data for subsequent uses
291 if ( ! is_array($this->row_data))
292 {
293 $this->row_data = $this->row_array(0);
294 }
Barry Mienydd671972010-10-04 16:33:58 +0200295
Derek Allard2067d1a2008-11-13 22:59:24 +0000296 if (is_array($key))
297 {
298 foreach ($key as $k => $v)
299 {
300 $this->row_data[$k] = $v;
301 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000302 return;
303 }
Barry Mienydd671972010-10-04 16:33:58 +0200304
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100305 if ($key !== '' && ! is_null($value))
Derek Allard2067d1a2008-11-13 22:59:24 +0000306 {
307 $this->row_data[$key] = $value;
308 }
309 }
310
311 // --------------------------------------------------------------------
312
Greg Akere70e92b2011-04-25 10:50:53 -0500313 /**
John Crepezzi7b474302011-01-15 18:17:01 -0500314 * Returns a single result row - custom object version
315 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300316 * @param int $n
317 * @param string $type
John Crepezzi7b474302011-01-15 18:17:01 -0500318 * @return object
319 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300320 public function custom_row_object($n, $type)
John Crepezzi7b474302011-01-15 18:17:01 -0500321 {
Andrey Andreev34d67992012-07-05 14:37:36 +0300322 isset($this->custom_result_object[$type]) OR $this->custom_result_object($type);
323
324 if (count($this->custom_result_object[$type]) === 0)
John Crepezzi7b474302011-01-15 18:17:01 -0500325 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300326 return NULL;
John Crepezzi7b474302011-01-15 18:17:01 -0500327 }
328
Andrey Andreev34d67992012-07-05 14:37:36 +0300329 if ($n !== $this->current_row && isset($this->custom_result_object[$type][$n]))
John Crepezzi7b474302011-01-15 18:17:01 -0500330 {
331 $this->current_row = $n;
332 }
333
Andrey Andreev34d67992012-07-05 14:37:36 +0300334 return $this->custom_result_object[$type][$this->current_row];
John Crepezzi7b474302011-01-15 18:17:01 -0500335 }
336
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300337 // --------------------------------------------------------------------
338
Greg Akere70e92b2011-04-25 10:50:53 -0500339 /**
Derek Allard2067d1a2008-11-13 22:59:24 +0000340 * Returns a single result row - object version
341 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300342 * @param int $n = 0
Derek Allard2067d1a2008-11-13 22:59:24 +0000343 * @return object
Barry Mienydd671972010-10-04 16:33:58 +0200344 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300345 public function row_object($n = 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000346 {
347 $result = $this->result_object();
Andrey Andreev24276a32012-01-08 02:44:38 +0200348 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000349 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300350 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000351 }
352
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100353 if ($n !== $this->current_row && isset($result[$n]))
Derek Allard2067d1a2008-11-13 22:59:24 +0000354 {
355 $this->current_row = $n;
356 }
357
358 return $result[$this->current_row];
359 }
360
361 // --------------------------------------------------------------------
362
363 /**
364 * Returns a single result row - array version
365 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300366 * @param int $n = 0
Derek Allard2067d1a2008-11-13 22:59:24 +0000367 * @return array
Barry Mienydd671972010-10-04 16:33:58 +0200368 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300369 public function row_array($n = 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000370 {
371 $result = $this->result_array();
Andrey Andreev24276a32012-01-08 02:44:38 +0200372 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000373 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300374 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000375 }
Barry Mienydd671972010-10-04 16:33:58 +0200376
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100377 if ($n !== $this->current_row && isset($result[$n]))
Derek Allard2067d1a2008-11-13 22:59:24 +0000378 {
379 $this->current_row = $n;
380 }
Barry Mienydd671972010-10-04 16:33:58 +0200381
Derek Allard2067d1a2008-11-13 22:59:24 +0000382 return $result[$this->current_row];
383 }
384
Derek Allard2067d1a2008-11-13 22:59:24 +0000385 // --------------------------------------------------------------------
386
387 /**
388 * Returns the "first" row
389 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300390 * @param string $type = 'object'
391 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200392 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300393 public function first_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000394 {
395 $result = $this->result($type);
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300396 return (count($result) === 0) ? NULL : $result[0];
Derek Allard2067d1a2008-11-13 22:59:24 +0000397 }
Barry Mienydd671972010-10-04 16:33:58 +0200398
Derek Allard2067d1a2008-11-13 22:59:24 +0000399 // --------------------------------------------------------------------
400
401 /**
402 * Returns the "last" row
403 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300404 * @param string $type = 'object'
405 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200406 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300407 public function last_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000408 {
409 $result = $this->result($type);
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300410 return (count($result) === 0) ? NULL : $result[count($result) - 1];
Barry Mienydd671972010-10-04 16:33:58 +0200411 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000412
413 // --------------------------------------------------------------------
414
415 /**
416 * Returns the "next" row
417 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300418 * @param string $type = 'object'
419 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200420 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300421 public function next_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000422 {
423 $result = $this->result($type);
Andrey Andreev24276a32012-01-08 02:44:38 +0200424 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000425 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300426 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000427 }
428
429 if (isset($result[$this->current_row + 1]))
430 {
431 ++$this->current_row;
432 }
Barry Mienydd671972010-10-04 16:33:58 +0200433
Derek Allard2067d1a2008-11-13 22:59:24 +0000434 return $result[$this->current_row];
435 }
Barry Mienydd671972010-10-04 16:33:58 +0200436
Derek Allard2067d1a2008-11-13 22:59:24 +0000437 // --------------------------------------------------------------------
438
439 /**
440 * Returns the "previous" row
441 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300442 * @param string $type = 'object'
443 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200444 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300445 public function previous_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000446 {
447 $result = $this->result($type);
Andrey Andreev24276a32012-01-08 02:44:38 +0200448 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000449 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300450 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000451 }
452
453 if (isset($result[$this->current_row - 1]))
454 {
455 --$this->current_row;
456 }
457 return $result[$this->current_row];
458 }
459
460 // --------------------------------------------------------------------
461
462 /**
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300463 * Returns an unbuffered row and move pointer to next row
464 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300465 * @param string $type = 'object' 'array', 'object' or a custom class name
466 * @return mixed
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300467 */
468 public function unbuffered_row($type = 'object')
469 {
Andrey Andreev9a4f3562012-07-06 11:57:37 +0300470 if ($type === 'array')
471 {
472 return $this->_fetch_assoc();
473 }
474 elseif ($type === 'object')
475 {
476 return $this->_fetch_object();
477 }
478
479 return $this->_fetch_object($type);
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300480 }
481
482 // --------------------------------------------------------------------
Andrey Andreev79922c02012-05-23 12:27:17 +0300483
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300484 /**
Derek Allard2067d1a2008-11-13 22:59:24 +0000485 * The following functions are normally overloaded by the identically named
486 * methods in the platform-specific driver -- except when query caching
Andrey Andreev38b2a252012-03-29 11:35:32 +0300487 * is used. When caching is enabled we do not load the other driver.
Derek Allard2067d1a2008-11-13 22:59:24 +0000488 * These functions are primarily here to prevent undefined function errors
Andrey Andreev38b2a252012-03-29 11:35:32 +0300489 * when a cached result object is in use. They are not otherwise fully
Derek Allard2067d1a2008-11-13 22:59:24 +0000490 * operational due to the unavailability of the database resource IDs with
491 * cached results.
492 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300493 public function num_fields() { return 0; }
494 public function list_fields() { return array(); }
495 public function field_data() { return array(); }
Andrey Andreev38b2a252012-03-29 11:35:32 +0300496 public function free_result() { $this->result_id = FALSE; }
Andrey Andreev8f3566f2012-04-12 14:30:05 +0300497 protected function _data_seek() { return FALSE; }
Andrey Andreevbc95e472011-10-20 09:44:48 +0300498 protected function _fetch_assoc() { return array(); }
499 protected function _fetch_object() { return array(); }
Barry Mienydd671972010-10-04 16:33:58 +0200500
Derek Allard2067d1a2008-11-13 22:59:24 +0000501}
Derek Allard2067d1a2008-11-13 22:59:24 +0000502
503/* End of file DB_result.php */
Timothy Warren215890b2012-03-20 09:38:16 -0400504/* Location: ./system/database/DB_result.php */