blob: 704fd7cc295ed458526b97287ffcbe35eb9dcb39 [file] [log] [blame]
Andrey Andreevc5536aa2012-11-01 17:33:58 +02001<?php
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 */
Andrey Andreevc5536aa2012-11-01 17:33:58 +020027defined('BASEPATH') OR exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +000028
Derek Allard2067d1a2008-11-13 22:59:24 +000029/**
30 * Database Result Class
31 *
32 * This is the platform-independent result class.
33 * This class will not be called directly. Rather, the adapter
34 * class for the specific database will extend and instantiate it.
35 *
36 * @category Database
Derek Jonesf4a4bd82011-10-20 12:18:42 -050037 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000038 * @link http://codeigniter.com/user_guide/database/
39 */
Andrey Andreev6dd4aff2012-03-20 15:54:23 +020040class CI_DB_result {
Derek Allard2067d1a2008-11-13 22:59:24 +000041
Andrey Andreev5ca05132012-07-05 12:06:34 +030042 public $conn_id;
43 public $result_id;
Andrey Andreev24276a32012-01-08 02:44:38 +020044 public $result_array = array();
45 public $result_object = array();
46 public $custom_result_object = array();
47 public $current_row = 0;
Andrey Andreev5ca05132012-07-05 12:06:34 +030048 public $num_rows;
49 public $row_data;
Derek Allard2067d1a2008-11-13 22:59:24 +000050
Andrey Andreev5ca05132012-07-05 12:06:34 +030051 /**
52 * Constructor
53 *
54 * @param object
55 * @return void
56 */
Andrey Andreev57bdeb62012-03-05 15:59:16 +020057 public function __construct(&$driver_object)
58 {
59 $this->conn_id = $driver_object->conn_id;
60 $this->result_id = $driver_object->result_id;
61 }
62
Andrey Andreev5ca05132012-07-05 12:06:34 +030063 // --------------------------------------------------------------------
64
Derek Allard2067d1a2008-11-13 22:59:24 +000065 /**
Andrey Andreev5ca05132012-07-05 12:06:34 +030066 * Number of rows in the result set
Derek Allard2067d1a2008-11-13 22:59:24 +000067 *
Andrey Andreev5ca05132012-07-05 12:06:34 +030068 * @return int
69 */
70 public function num_rows()
71 {
Andrey Andreevc7db6bb2012-07-05 15:11:20 +030072 if (is_int($this->num_rows))
73 {
74 return $this->num_rows;
75 }
76 elseif (count($this->result_array) > 0)
77 {
78 return $this->num_rows = count($this->result_array);
79 }
80 elseif (count($this->result_object) > 0)
81 {
82 return $this->num_rows = count($this->result_object);
83 }
84
85 return $this->num_rows = count($this->result_array());
Andrey Andreev5ca05132012-07-05 12:06:34 +030086 }
87
88 // --------------------------------------------------------------------
89
90 /**
91 * Query result. Acts as a wrapper function for the following functions.
92 *
93 * @param string 'object', 'array' or a custom class name
94 * @return array
Barry Mienydd671972010-10-04 16:33:58 +020095 */
Andrey Andreevbc95e472011-10-20 09:44:48 +030096 public function result($type = 'object')
Barry Mienydd671972010-10-04 16:33:58 +020097 {
Andrey Andreev5ca05132012-07-05 12:06:34 +030098 if ($type === 'array')
99 {
100 return $this->result_array();
101 }
102 elseif ($type === 'object')
103 {
104 return $this->result_object();
105 }
106 else
107 {
108 return $this->custom_result_object($type);
109 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000110 }
111
112 // --------------------------------------------------------------------
113
Greg Akere70e92b2011-04-25 10:50:53 -0500114 /**
115 * Custom query result.
116 *
Andrey Andreev24276a32012-01-08 02:44:38 +0200117 * @param string A string that represents the type of object you want back
118 * @return array of objects
Greg Akere70e92b2011-04-25 10:50:53 -0500119 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300120 public function custom_result_object($class_name)
Greg Akere70e92b2011-04-25 10:50:53 -0500121 {
Andrey Andreev4763c132012-07-05 13:58:18 +0300122 if (isset($this->custom_result_object[$class_name]))
Greg Akere70e92b2011-04-25 10:50:53 -0500123 {
124 return $this->custom_result_object[$class_name];
125 }
Andrey Andreev4763c132012-07-05 13:58:18 +0300126 elseif ( ! $this->result_id OR $this->num_rows === 0)
Greg Akere70e92b2011-04-25 10:50:53 -0500127 {
128 return array();
129 }
Razican114ab092011-04-25 17:26:45 +0200130
Andrey Andreev4763c132012-07-05 13:58:18 +0300131 // Don't fetch the result set again if we already have it
132 $_data = NULL;
133 if (($c = count($this->result_array)) > 0)
134 {
135 $_data = 'result_array';
136 }
137 elseif (($c = count($this->result_object)) > 0)
138 {
139 $_data = 'result_object';
140 }
141
142 if ($_data !== NULL)
143 {
144 for ($i = 0; $i < $c; $i++)
145 {
146 $this->custom_result_object[$class_name][$i] = new $class_name();
147
Andrey Andreev0db81b62012-07-08 22:00:17 +0300148 foreach ($this->{$_data}[$i] as $key => $value)
Andrey Andreev4763c132012-07-05 13:58:18 +0300149 {
150 $this->custom_result_object[$class_name][$i]->$key = $value;
151 }
152 }
153
154 return $this->custom_result_object[$class_name];
155 }
156
Greg Akere70e92b2011-04-25 10:50:53 -0500157 $this->_data_seek(0);
Andrey Andreev4763c132012-07-05 13:58:18 +0300158 $this->custom_result_object[$class_name] = array();
Greg Akere70e92b2011-04-25 10:50:53 -0500159
Andrey Andreev9a4f3562012-07-06 11:57:37 +0300160 while ($row = $this->_fetch_object($class_name))
Greg Akere70e92b2011-04-25 10:50:53 -0500161 {
Jon Ellis-Jonesc4efbdc2012-07-07 10:30:29 +0100162 $this->custom_result_object[$class_name][] = $row;
John Crepezzi7b474302011-01-15 18:17:01 -0500163 }
164
Andrey Andreev4763c132012-07-05 13:58:18 +0300165 return $this->custom_result_object[$class_name];
Greg Akere70e92b2011-04-25 10:50:53 -0500166 }
167
168 // --------------------------------------------------------------------
John Crepezzi7b474302011-01-15 18:17:01 -0500169
Derek Allard2067d1a2008-11-13 22:59:24 +0000170 /**
Andrey Andreev38b2a252012-03-29 11:35:32 +0300171 * Query result. "object" version.
Derek Allard2067d1a2008-11-13 22:59:24 +0000172 *
Andrey Andreev38b2a252012-03-29 11:35:32 +0300173 * @return array
Barry Mienydd671972010-10-04 16:33:58 +0200174 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300175 public function result_object()
Derek Allard2067d1a2008-11-13 22:59:24 +0000176 {
177 if (count($this->result_object) > 0)
178 {
179 return $this->result_object;
180 }
Barry Mienydd671972010-10-04 16:33:58 +0200181
Andrey Andreev4763c132012-07-05 13:58:18 +0300182 // In the event that query caching is on, the result_id variable
183 // will not be a valid resource so we'll simply return an empty
184 // array.
185 if ( ! $this->result_id OR $this->num_rows === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000186 {
187 return array();
188 }
189
Andrey Andreev4763c132012-07-05 13:58:18 +0300190 if (($c = count($this->result_array)) > 0)
191 {
192 for ($i = 0; $i < $c; $i++)
193 {
194 $this->result_object[$i] = (object) $this->result_array[$i];
195 }
196
197 return $this->result_object;
198 }
199
Derek Allard2067d1a2008-11-13 22:59:24 +0000200 $this->_data_seek(0);
201 while ($row = $this->_fetch_object())
202 {
203 $this->result_object[] = $row;
204 }
Barry Mienydd671972010-10-04 16:33:58 +0200205
Derek Allard2067d1a2008-11-13 22:59:24 +0000206 return $this->result_object;
207 }
Barry Mienydd671972010-10-04 16:33:58 +0200208
Derek Allard2067d1a2008-11-13 22:59:24 +0000209 // --------------------------------------------------------------------
210
211 /**
Andrey Andreev5ca05132012-07-05 12:06:34 +0300212 * Query result. "array" version.
Derek Allard2067d1a2008-11-13 22:59:24 +0000213 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000214 * @return array
Barry Mienydd671972010-10-04 16:33:58 +0200215 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300216 public function result_array()
Derek Allard2067d1a2008-11-13 22:59:24 +0000217 {
218 if (count($this->result_array) > 0)
219 {
220 return $this->result_array;
221 }
222
Andrey Andreev4763c132012-07-05 13:58:18 +0300223 // In the event that query caching is on, the result_id variable
224 // will not be a valid resource so we'll simply return an empty
225 // array.
226 if ( ! $this->result_id OR $this->num_rows === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000227 {
228 return array();
229 }
230
Andrey Andreev4763c132012-07-05 13:58:18 +0300231 if (($c = count($this->result_object)) > 0)
232 {
233 for ($i = 0; $i < $c; $i++)
234 {
235 $this->result_array[$i] = (array) $this->result_object[$i];
236 }
237
238 return $this->result_array;
239 }
240
Derek Allard2067d1a2008-11-13 22:59:24 +0000241 $this->_data_seek(0);
242 while ($row = $this->_fetch_assoc())
243 {
244 $this->result_array[] = $row;
245 }
Barry Mienydd671972010-10-04 16:33:58 +0200246
Derek Allard2067d1a2008-11-13 22:59:24 +0000247 return $this->result_array;
248 }
249
250 // --------------------------------------------------------------------
251
252 /**
Derek Jones37f4b9c2011-07-01 17:56:50 -0500253 * Query result. Acts as a wrapper function for the following functions.
Derek Allard2067d1a2008-11-13 22:59:24 +0000254 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300255 * @param mixed $n = 0
256 * @param string $type = 'object' 'object' or 'array'
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300257 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200258 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300259 public function row($n = 0, $type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000260 {
261 if ( ! is_numeric($n))
262 {
263 // We cache the row data for subsequent uses
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300264 is_array($this->row_data) OR $this->row_data = $this->row_array(0);
265
266 // array_key_exists() instead of isset() to allow for NULL values
267 if (empty($this->row_data) OR ! array_key_exists($n, $this->row_data))
Derek Allard2067d1a2008-11-13 22:59:24 +0000268 {
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300269 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000270 }
Barry Mienydd671972010-10-04 16:33:58 +0200271
Andrey Andreev9f6bdc02012-10-22 23:31:10 +0300272 return $this->row_data[$n];
Derek Allard2067d1a2008-11-13 22:59:24 +0000273 }
Barry Mienydd671972010-10-04 16:33:58 +0200274
Andrey Andreev24276a32012-01-08 02:44:38 +0200275 if ($type === 'object') return $this->row_object($n);
276 elseif ($type === 'array') return $this->row_array($n);
Greg Akere70e92b2011-04-25 10:50:53 -0500277 else return $this->custom_row_object($n, $type);
Derek Allard2067d1a2008-11-13 22:59:24 +0000278 }
279
280 // --------------------------------------------------------------------
281
282 /**
283 * Assigns an item into a particular column slot
284 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300285 * @param mixed $key
286 * @param mixed $value
Andrey Andreev24276a32012-01-08 02:44:38 +0200287 * @return void
Barry Mienydd671972010-10-04 16:33:58 +0200288 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300289 public function set_row($key, $value = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000290 {
291 // We cache the row data for subsequent uses
292 if ( ! is_array($this->row_data))
293 {
294 $this->row_data = $this->row_array(0);
295 }
Barry Mienydd671972010-10-04 16:33:58 +0200296
Derek Allard2067d1a2008-11-13 22:59:24 +0000297 if (is_array($key))
298 {
299 foreach ($key as $k => $v)
300 {
301 $this->row_data[$k] = $v;
302 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000303 return;
304 }
Barry Mienydd671972010-10-04 16:33:58 +0200305
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100306 if ($key !== '' && ! is_null($value))
Derek Allard2067d1a2008-11-13 22:59:24 +0000307 {
308 $this->row_data[$key] = $value;
309 }
310 }
311
312 // --------------------------------------------------------------------
313
Greg Akere70e92b2011-04-25 10:50:53 -0500314 /**
John Crepezzi7b474302011-01-15 18:17:01 -0500315 * Returns a single result row - custom object version
316 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300317 * @param int $n
318 * @param string $type
John Crepezzi7b474302011-01-15 18:17:01 -0500319 * @return object
320 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300321 public function custom_row_object($n, $type)
John Crepezzi7b474302011-01-15 18:17:01 -0500322 {
Andrey Andreev34d67992012-07-05 14:37:36 +0300323 isset($this->custom_result_object[$type]) OR $this->custom_result_object($type);
324
325 if (count($this->custom_result_object[$type]) === 0)
John Crepezzi7b474302011-01-15 18:17:01 -0500326 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300327 return NULL;
John Crepezzi7b474302011-01-15 18:17:01 -0500328 }
329
Andrey Andreev34d67992012-07-05 14:37:36 +0300330 if ($n !== $this->current_row && isset($this->custom_result_object[$type][$n]))
John Crepezzi7b474302011-01-15 18:17:01 -0500331 {
332 $this->current_row = $n;
333 }
334
Andrey Andreev34d67992012-07-05 14:37:36 +0300335 return $this->custom_result_object[$type][$this->current_row];
John Crepezzi7b474302011-01-15 18:17:01 -0500336 }
337
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300338 // --------------------------------------------------------------------
339
Greg Akere70e92b2011-04-25 10:50:53 -0500340 /**
Derek Allard2067d1a2008-11-13 22:59:24 +0000341 * Returns a single result row - object version
342 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300343 * @param int $n = 0
Derek Allard2067d1a2008-11-13 22:59:24 +0000344 * @return object
Barry Mienydd671972010-10-04 16:33:58 +0200345 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300346 public function row_object($n = 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000347 {
348 $result = $this->result_object();
Andrey Andreev24276a32012-01-08 02:44:38 +0200349 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000350 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300351 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000352 }
353
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100354 if ($n !== $this->current_row && isset($result[$n]))
Derek Allard2067d1a2008-11-13 22:59:24 +0000355 {
356 $this->current_row = $n;
357 }
358
359 return $result[$this->current_row];
360 }
361
362 // --------------------------------------------------------------------
363
364 /**
365 * Returns a single result row - array version
366 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300367 * @param int $n = 0
Derek Allard2067d1a2008-11-13 22:59:24 +0000368 * @return array
Barry Mienydd671972010-10-04 16:33:58 +0200369 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300370 public function row_array($n = 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000371 {
372 $result = $this->result_array();
Andrey Andreev24276a32012-01-08 02:44:38 +0200373 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000374 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300375 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000376 }
Barry Mienydd671972010-10-04 16:33:58 +0200377
Alex Bilbie48a2baf2012-06-02 11:09:54 +0100378 if ($n !== $this->current_row && isset($result[$n]))
Derek Allard2067d1a2008-11-13 22:59:24 +0000379 {
380 $this->current_row = $n;
381 }
Barry Mienydd671972010-10-04 16:33:58 +0200382
Derek Allard2067d1a2008-11-13 22:59:24 +0000383 return $result[$this->current_row];
384 }
385
Derek Allard2067d1a2008-11-13 22:59:24 +0000386 // --------------------------------------------------------------------
387
388 /**
389 * Returns the "first" row
390 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300391 * @param string $type = 'object'
392 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200393 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300394 public function first_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000395 {
396 $result = $this->result($type);
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300397 return (count($result) === 0) ? NULL : $result[0];
Derek Allard2067d1a2008-11-13 22:59:24 +0000398 }
Barry Mienydd671972010-10-04 16:33:58 +0200399
Derek Allard2067d1a2008-11-13 22:59:24 +0000400 // --------------------------------------------------------------------
401
402 /**
403 * Returns the "last" row
404 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300405 * @param string $type = 'object'
406 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200407 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300408 public function last_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000409 {
410 $result = $this->result($type);
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300411 return (count($result) === 0) ? NULL : $result[count($result) - 1];
Barry Mienydd671972010-10-04 16:33:58 +0200412 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000413
414 // --------------------------------------------------------------------
415
416 /**
417 * Returns the "next" row
418 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300419 * @param string $type = 'object'
420 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200421 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300422 public function next_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000423 {
424 $result = $this->result($type);
Andrey Andreev24276a32012-01-08 02:44:38 +0200425 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000426 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300427 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000428 }
429
430 if (isset($result[$this->current_row + 1]))
431 {
432 ++$this->current_row;
433 }
Barry Mienydd671972010-10-04 16:33:58 +0200434
Derek Allard2067d1a2008-11-13 22:59:24 +0000435 return $result[$this->current_row];
436 }
Barry Mienydd671972010-10-04 16:33:58 +0200437
Derek Allard2067d1a2008-11-13 22:59:24 +0000438 // --------------------------------------------------------------------
439
440 /**
441 * Returns the "previous" row
442 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300443 * @param string $type = 'object'
444 * @return mixed
Barry Mienydd671972010-10-04 16:33:58 +0200445 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300446 public function previous_row($type = 'object')
Derek Allard2067d1a2008-11-13 22:59:24 +0000447 {
448 $result = $this->result($type);
Andrey Andreev24276a32012-01-08 02:44:38 +0200449 if (count($result) === 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000450 {
Andrey Andreev55d3ad42012-05-24 22:13:06 +0300451 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000452 }
453
454 if (isset($result[$this->current_row - 1]))
455 {
456 --$this->current_row;
457 }
458 return $result[$this->current_row];
459 }
460
461 // --------------------------------------------------------------------
462
463 /**
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300464 * Returns an unbuffered row and move pointer to next row
465 *
Andrey Andreev5fd3ae82012-10-24 14:55:35 +0300466 * @param string $type = 'object' 'array', 'object' or a custom class name
467 * @return mixed
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300468 */
469 public function unbuffered_row($type = 'object')
470 {
Andrey Andreev9a4f3562012-07-06 11:57:37 +0300471 if ($type === 'array')
472 {
473 return $this->_fetch_assoc();
474 }
475 elseif ($type === 'object')
476 {
477 return $this->_fetch_object();
478 }
479
480 return $this->_fetch_object($type);
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300481 }
482
483 // --------------------------------------------------------------------
Andrey Andreev79922c02012-05-23 12:27:17 +0300484
Juan Ignacio Borda3020b242012-05-18 18:27:50 -0300485 /**
Derek Allard2067d1a2008-11-13 22:59:24 +0000486 * The following functions are normally overloaded by the identically named
487 * methods in the platform-specific driver -- except when query caching
Andrey Andreev38b2a252012-03-29 11:35:32 +0300488 * is used. When caching is enabled we do not load the other driver.
Derek Allard2067d1a2008-11-13 22:59:24 +0000489 * These functions are primarily here to prevent undefined function errors
Andrey Andreev38b2a252012-03-29 11:35:32 +0300490 * when a cached result object is in use. They are not otherwise fully
Derek Allard2067d1a2008-11-13 22:59:24 +0000491 * operational due to the unavailability of the database resource IDs with
492 * cached results.
493 */
Andrey Andreevbc95e472011-10-20 09:44:48 +0300494 public function num_fields() { return 0; }
495 public function list_fields() { return array(); }
496 public function field_data() { return array(); }
Andrey Andreev38b2a252012-03-29 11:35:32 +0300497 public function free_result() { $this->result_id = FALSE; }
Andrey Andreev8f3566f2012-04-12 14:30:05 +0300498 protected function _data_seek() { return FALSE; }
Andrey Andreevbc95e472011-10-20 09:44:48 +0300499 protected function _fetch_assoc() { return array(); }
500 protected function _fetch_object() { return array(); }
Barry Mienydd671972010-10-04 16:33:58 +0200501
Derek Allard2067d1a2008-11-13 22:59:24 +0000502}
Derek Allard2067d1a2008-11-13 22:59:24 +0000503
504/* End of file DB_result.php */
Timothy Warren215890b2012-03-20 09:38:16 -0400505/* Location: ./system/database/DB_result.php */