blob: 3eaec949cec7e2f4e88934c10ce3046f6414643a [file] [log] [blame]
Derek Jones4b9c6292011-07-01 17:40:48 -05001<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Greg Aker741de1c2010-11-10 14:52:57 -06005 * An open source application development framework for PHP 5.1.6 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
8 *
9 * Licensed under the Open Software License version 3.0
10 *
11 * 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
28// ------------------------------------------------------------------------
29
30
31
32/**
33 * SQLite Database Adapter Class
34 *
35 * Note: _DB is an extender class that the app controller
36 * creates dynamically based on whether the active record
37 * class is being used or not.
38 *
39 * @package CodeIgniter
40 * @subpackage Drivers
41 * @category Database
Derek Jonesf4a4bd82011-10-20 12:18:42 -050042 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000043 * @link http://codeigniter.com/user_guide/database/
44 */
45class CI_DB_sqlite_driver extends CI_DB {
46
47 var $dbdriver = 'sqlite';
Barry Mienydd671972010-10-04 16:33:58 +020048
Derek Allard2067d1a2008-11-13 22:59:24 +000049 // The character used to escape with - not needed for SQLite
50 var $_escape_char = '';
51
Derek Jonese4ed5832009-02-20 21:44:59 +000052 // clause and character used for LIKE escape sequences
Barry Mienydd671972010-10-04 16:33:58 +020053 var $_like_escape_str = " ESCAPE '%s' ";
Derek Jonese4ed5832009-02-20 21:44:59 +000054 var $_like_escape_chr = '!';
Barry Mienydd671972010-10-04 16:33:58 +020055
Derek Allard2067d1a2008-11-13 22:59:24 +000056 /**
57 * The syntax to count rows is slightly different across different
58 * database engines, so this string appears in each driver and is
59 * used for the count_all() and count_all_results() functions.
60 */
61 var $_count_string = "SELECT COUNT(*) AS ";
62 var $_random_keyword = ' Random()'; // database specific random keyword
63
64 /**
65 * Non-persistent database connection
66 *
67 * @access private called by the base class
68 * @return resource
Barry Mienydd671972010-10-04 16:33:58 +020069 */
Derek Allard2067d1a2008-11-13 22:59:24 +000070 function db_connect()
71 {
72 if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error))
73 {
74 log_message('error', $error);
Barry Mienydd671972010-10-04 16:33:58 +020075
Derek Allard2067d1a2008-11-13 22:59:24 +000076 if ($this->db_debug)
77 {
Derek Allardfac8fbc2010-02-05 16:14:49 +000078 $this->display_error($error, '', TRUE);
Derek Allard2067d1a2008-11-13 22:59:24 +000079 }
Barry Mienydd671972010-10-04 16:33:58 +020080
Derek Allard2067d1a2008-11-13 22:59:24 +000081 return FALSE;
82 }
Barry Mienydd671972010-10-04 16:33:58 +020083
Derek Allard2067d1a2008-11-13 22:59:24 +000084 return $conn_id;
85 }
Barry Mienydd671972010-10-04 16:33:58 +020086
Derek Allard2067d1a2008-11-13 22:59:24 +000087 // --------------------------------------------------------------------
88
89 /**
90 * Persistent database connection
91 *
92 * @access private called by the base class
93 * @return resource
Barry Mienydd671972010-10-04 16:33:58 +020094 */
Derek Allard2067d1a2008-11-13 22:59:24 +000095 function db_pconnect()
96 {
97 if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error))
98 {
99 log_message('error', $error);
Barry Mienydd671972010-10-04 16:33:58 +0200100
Derek Allard2067d1a2008-11-13 22:59:24 +0000101 if ($this->db_debug)
102 {
Derek Allardfac8fbc2010-02-05 16:14:49 +0000103 $this->display_error($error, '', TRUE);
Derek Allard2067d1a2008-11-13 22:59:24 +0000104 }
Barry Mienydd671972010-10-04 16:33:58 +0200105
Derek Allard2067d1a2008-11-13 22:59:24 +0000106 return FALSE;
107 }
Barry Mienydd671972010-10-04 16:33:58 +0200108
Derek Allard2067d1a2008-11-13 22:59:24 +0000109 return $conn_id;
110 }
Barry Mienydd671972010-10-04 16:33:58 +0200111
Derek Allard2067d1a2008-11-13 22:59:24 +0000112 // --------------------------------------------------------------------
113
114 /**
Derek Jones87cbafc2009-02-27 16:29:59 +0000115 * Reconnect
116 *
117 * Keep / reestablish the db connection if no queries have been
118 * sent for a length of time exceeding the server's idle timeout
119 *
120 * @access public
121 * @return void
122 */
123 function reconnect()
124 {
125 // not implemented in SQLite
126 }
127
128 // --------------------------------------------------------------------
129
130 /**
Derek Allard2067d1a2008-11-13 22:59:24 +0000131 * Select the database
132 *
133 * @access private called by the base class
134 * @return resource
Barry Mienydd671972010-10-04 16:33:58 +0200135 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000136 function db_select()
137 {
138 return TRUE;
139 }
140
141 // --------------------------------------------------------------------
142
143 /**
Andrey Andreev08856b82012-03-03 03:19:28 +0200144 * Database version number
Derek Allard2067d1a2008-11-13 22:59:24 +0000145 *
Derek Allard2067d1a2008-11-13 22:59:24 +0000146 * @return string
147 */
Andrey Andreev08856b82012-03-03 03:19:28 +0200148 public function version()
Derek Allard2067d1a2008-11-13 22:59:24 +0000149 {
Andrey Andreev08856b82012-03-03 03:19:28 +0200150 return isset($this->data_cache['version'])
151 ? $this->data_cache['version']
152 : $this->data_cache['version'] = sqlite_libversion();
Derek Allard2067d1a2008-11-13 22:59:24 +0000153 }
Barry Mienydd671972010-10-04 16:33:58 +0200154
Derek Allard2067d1a2008-11-13 22:59:24 +0000155 // --------------------------------------------------------------------
156
157 /**
158 * Execute the query
159 *
160 * @access private called by the base class
161 * @param string an SQL query
162 * @return resource
Barry Mienydd671972010-10-04 16:33:58 +0200163 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000164 function _execute($sql)
165 {
166 $sql = $this->_prep_query($sql);
167 return @sqlite_query($this->conn_id, $sql);
168 }
Barry Mienydd671972010-10-04 16:33:58 +0200169
Derek Allard2067d1a2008-11-13 22:59:24 +0000170 // --------------------------------------------------------------------
171
172 /**
173 * Prep the query
174 *
175 * If needed, each database adapter can prep the query string
176 *
177 * @access private called by execute()
178 * @param string an SQL query
179 * @return string
Barry Mienydd671972010-10-04 16:33:58 +0200180 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000181 function _prep_query($sql)
182 {
183 return $sql;
184 }
185
186 // --------------------------------------------------------------------
187
188 /**
189 * Begin Transaction
190 *
191 * @access public
Barry Mienydd671972010-10-04 16:33:58 +0200192 * @return bool
193 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000194 function trans_begin($test_mode = FALSE)
195 {
196 if ( ! $this->trans_enabled)
197 {
198 return TRUE;
199 }
Barry Mienydd671972010-10-04 16:33:58 +0200200
Derek Allard2067d1a2008-11-13 22:59:24 +0000201 // When transactions are nested we only begin/commit/rollback the outermost ones
202 if ($this->_trans_depth > 0)
203 {
204 return TRUE;
205 }
206
207 // Reset the transaction failure flag.
208 // If the $test_mode flag is set to TRUE transactions will be rolled back
209 // even if the queries produce a successful result.
210 $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
211
212 $this->simple_query('BEGIN TRANSACTION');
213 return TRUE;
214 }
215
216 // --------------------------------------------------------------------
217
218 /**
219 * Commit Transaction
220 *
221 * @access public
Barry Mienydd671972010-10-04 16:33:58 +0200222 * @return bool
223 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000224 function trans_commit()
225 {
226 if ( ! $this->trans_enabled)
227 {
228 return TRUE;
229 }
230
231 // When transactions are nested we only begin/commit/rollback the outermost ones
232 if ($this->_trans_depth > 0)
233 {
234 return TRUE;
235 }
236
237 $this->simple_query('COMMIT');
238 return TRUE;
239 }
240
241 // --------------------------------------------------------------------
242
243 /**
244 * Rollback Transaction
245 *
246 * @access public
Barry Mienydd671972010-10-04 16:33:58 +0200247 * @return bool
248 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000249 function trans_rollback()
250 {
251 if ( ! $this->trans_enabled)
252 {
253 return TRUE;
254 }
255
256 // When transactions are nested we only begin/commit/rollback the outermost ones
257 if ($this->_trans_depth > 0)
258 {
259 return TRUE;
260 }
261
262 $this->simple_query('ROLLBACK');
263 return TRUE;
264 }
Barry Mienydd671972010-10-04 16:33:58 +0200265
Derek Allard2067d1a2008-11-13 22:59:24 +0000266 // --------------------------------------------------------------------
267
268 /**
269 * Escape String
270 *
271 * @access public
272 * @param string
Derek Jonese4ed5832009-02-20 21:44:59 +0000273 * @param bool whether or not the string will be used in a LIKE condition
Derek Allard2067d1a2008-11-13 22:59:24 +0000274 * @return string
275 */
Derek Jonese4ed5832009-02-20 21:44:59 +0000276 function escape_str($str, $like = FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000277 {
Derek Jonese4ed5832009-02-20 21:44:59 +0000278 if (is_array($str))
279 {
Pascal Krietec3a4a8d2011-02-14 13:40:08 -0500280 foreach ($str as $key => $val)
Barry Mienydd671972010-10-04 16:33:58 +0200281 {
Derek Jonese4ed5832009-02-20 21:44:59 +0000282 $str[$key] = $this->escape_str($val, $like);
Barry Mienydd671972010-10-04 16:33:58 +0200283 }
284
285 return $str;
286 }
287
Derek Jonese4ed5832009-02-20 21:44:59 +0000288 $str = sqlite_escape_string($str);
Barry Mienydd671972010-10-04 16:33:58 +0200289
Derek Jonese4ed5832009-02-20 21:44:59 +0000290 // escape LIKE condition wildcards
291 if ($like === TRUE)
292 {
293 $str = str_replace( array('%', '_', $this->_like_escape_chr),
294 array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
295 $str);
296 }
Barry Mienydd671972010-10-04 16:33:58 +0200297
Derek Jonese4ed5832009-02-20 21:44:59 +0000298 return $str;
Derek Allard2067d1a2008-11-13 22:59:24 +0000299 }
Barry Mienydd671972010-10-04 16:33:58 +0200300
Derek Allard2067d1a2008-11-13 22:59:24 +0000301 // --------------------------------------------------------------------
302
303 /**
304 * Affected Rows
305 *
306 * @access public
307 * @return integer
308 */
309 function affected_rows()
310 {
311 return sqlite_changes($this->conn_id);
312 }
Barry Mienydd671972010-10-04 16:33:58 +0200313
Derek Allard2067d1a2008-11-13 22:59:24 +0000314 // --------------------------------------------------------------------
315
316 /**
317 * Insert ID
318 *
319 * @access public
320 * @return integer
321 */
322 function insert_id()
323 {
324 return @sqlite_last_insert_rowid($this->conn_id);
325 }
326
327 // --------------------------------------------------------------------
328
329 /**
330 * "Count All" query
331 *
332 * Generates a platform-specific query string that counts all records in
333 * the specified database
334 *
335 * @access public
336 * @param string
337 * @return string
338 */
339 function count_all($table = '')
340 {
341 if ($table == '')
Derek Allarde37ab382009-02-03 16:13:57 +0000342 {
343 return 0;
344 }
345
346 $query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
Barry Mienydd671972010-10-04 16:33:58 +0200347
Derek Allard2067d1a2008-11-13 22:59:24 +0000348 if ($query->num_rows() == 0)
Derek Allarde37ab382009-02-03 16:13:57 +0000349 {
350 return 0;
351 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000352
353 $row = $query->row();
Greg Aker90248ab2011-08-20 14:23:14 -0500354 $this->_reset_select();
Derek Allarde37ab382009-02-03 16:13:57 +0000355 return (int) $row->numrows;
Derek Allard2067d1a2008-11-13 22:59:24 +0000356 }
357
358 // --------------------------------------------------------------------
359
360 /**
361 * List table query
362 *
363 * Generates a platform-specific query string so that the table names can be fetched
364 *
365 * @access private
366 * @param boolean
367 * @return string
368 */
369 function _list_tables($prefix_limit = FALSE)
370 {
371 $sql = "SELECT name from sqlite_master WHERE type='table'";
372
373 if ($prefix_limit !== FALSE AND $this->dbprefix != '')
374 {
Greg Aker0d424892010-01-26 02:14:44 +0000375 $sql .= " AND 'name' LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
Derek Allard2067d1a2008-11-13 22:59:24 +0000376 }
377 return $sql;
378 }
379
380 // --------------------------------------------------------------------
381
382 /**
383 * Show column query
384 *
385 * Generates a platform-specific query string so that the column names can be fetched
386 *
387 * @access public
388 * @param string the table name
389 * @return string
390 */
391 function _list_columns($table = '')
392 {
393 // Not supported
394 return FALSE;
395 }
396
397 // --------------------------------------------------------------------
398
399 /**
400 * Field data query
401 *
402 * Generates a platform-specific query so that the column data can be retrieved
403 *
404 * @access public
405 * @param string the table name
406 * @return object
407 */
408 function _field_data($table)
409 {
410 return "SELECT * FROM ".$table." LIMIT 1";
411 }
412
413 // --------------------------------------------------------------------
414
415 /**
Andrey Andreev4be5de12012-03-02 15:45:41 +0200416 * Error
Derek Allard2067d1a2008-11-13 22:59:24 +0000417 *
Andrey Andreev4be5de12012-03-02 15:45:41 +0200418 * Returns an array containing code and message of the last
419 * database error that has occured.
Derek Allard2067d1a2008-11-13 22:59:24 +0000420 *
Andrey Andreev4be5de12012-03-02 15:45:41 +0200421 * @return array
Derek Allard2067d1a2008-11-13 22:59:24 +0000422 */
Andrey Andreev4be5de12012-03-02 15:45:41 +0200423 public function error()
Derek Allard2067d1a2008-11-13 22:59:24 +0000424 {
Andrey Andreev4be5de12012-03-02 15:45:41 +0200425 $error = array('code' => sqlite_last_error($this->conn_id));
426 $error['message'] = sqlite_error_string($error['code']);
427 return $error;
Derek Allard2067d1a2008-11-13 22:59:24 +0000428 }
429
430 // --------------------------------------------------------------------
431
432 /**
433 * Escape the SQL Identifiers
434 *
435 * This function escapes column and table names
436 *
437 * @access private
438 * @param string
439 * @return string
440 */
441 function _escape_identifiers($item)
442 {
443 if ($this->_escape_char == '')
444 {
445 return $item;
446 }
447
448 foreach ($this->_reserved_identifiers as $id)
449 {
450 if (strpos($item, '.'.$id) !== FALSE)
451 {
Barry Mienydd671972010-10-04 16:33:58 +0200452 $str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
453
Derek Allard2067d1a2008-11-13 22:59:24 +0000454 // remove duplicates if the user already included the escape
455 return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
Barry Mienydd671972010-10-04 16:33:58 +0200456 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000457 }
Barry Mienydd671972010-10-04 16:33:58 +0200458
Derek Allard2067d1a2008-11-13 22:59:24 +0000459 if (strpos($item, '.') !== FALSE)
460 {
Barry Mienydd671972010-10-04 16:33:58 +0200461 $str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
Derek Allard2067d1a2008-11-13 22:59:24 +0000462 }
463 else
464 {
465 $str = $this->_escape_char.$item.$this->_escape_char;
466 }
Barry Mienydd671972010-10-04 16:33:58 +0200467
Derek Allard2067d1a2008-11-13 22:59:24 +0000468 // remove duplicates if the user already included the escape
469 return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
470 }
Barry Mienydd671972010-10-04 16:33:58 +0200471
Derek Allard2067d1a2008-11-13 22:59:24 +0000472 // --------------------------------------------------------------------
473
474 /**
475 * From Tables
476 *
477 * This function implicitly groups FROM tables so there is no confusion
478 * about operator precedence in harmony with SQL standards
479 *
480 * @access public
481 * @param type
482 * @return type
483 */
484 function _from_tables($tables)
485 {
486 if ( ! is_array($tables))
487 {
488 $tables = array($tables);
489 }
Barry Mienydd671972010-10-04 16:33:58 +0200490
Derek Allard2067d1a2008-11-13 22:59:24 +0000491 return '('.implode(', ', $tables).')';
492 }
493
494 // --------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200495
Derek Allard2067d1a2008-11-13 22:59:24 +0000496 /**
497 * Insert statement
498 *
499 * Generates a platform-specific insert string from the supplied data
500 *
501 * @access public
502 * @param string the table name
503 * @param array the insert keys
504 * @param array the insert values
505 * @return string
506 */
507 function _insert($table, $keys, $values)
Barry Mienydd671972010-10-04 16:33:58 +0200508 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000509 return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
510 }
Barry Mienydd671972010-10-04 16:33:58 +0200511
Derek Allard2067d1a2008-11-13 22:59:24 +0000512 // --------------------------------------------------------------------
513
514 /**
515 * Update statement
516 *
517 * Generates a platform-specific update string from the supplied data
518 *
519 * @access public
520 * @param string the table name
521 * @param array the update data
522 * @param array the where clause
523 * @param array the orderby clause
524 * @param array the limit clause
525 * @return string
526 */
527 function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
528 {
Pascal Krietec3a4a8d2011-02-14 13:40:08 -0500529 foreach ($values as $key => $val)
Derek Allard2067d1a2008-11-13 22:59:24 +0000530 {
531 $valstr[] = $key." = ".$val;
532 }
Barry Mienydd671972010-10-04 16:33:58 +0200533
Derek Allard2067d1a2008-11-13 22:59:24 +0000534 $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
Barry Mienydd671972010-10-04 16:33:58 +0200535
Derek Allard2067d1a2008-11-13 22:59:24 +0000536 $orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
Barry Mienydd671972010-10-04 16:33:58 +0200537
Derek Allard2067d1a2008-11-13 22:59:24 +0000538 $sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
539
540 $sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
541
542 $sql .= $orderby.$limit;
Barry Mienydd671972010-10-04 16:33:58 +0200543
Derek Allard2067d1a2008-11-13 22:59:24 +0000544 return $sql;
545 }
546
Barry Mienydd671972010-10-04 16:33:58 +0200547
Derek Allard2067d1a2008-11-13 22:59:24 +0000548 // --------------------------------------------------------------------
549
550 /**
551 * Truncate statement
552 *
553 * Generates a platform-specific truncate string from the supplied data
554 * If the database does not support the truncate() command
555 * This function maps to "DELETE FROM table"
556 *
557 * @access public
558 * @param string the table name
559 * @return string
Barry Mienydd671972010-10-04 16:33:58 +0200560 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000561 function _truncate($table)
562 {
563 return $this->_delete($table);
564 }
Barry Mienydd671972010-10-04 16:33:58 +0200565
Derek Allard2067d1a2008-11-13 22:59:24 +0000566 // --------------------------------------------------------------------
567
568 /**
569 * Delete statement
570 *
571 * Generates a platform-specific delete string from the supplied data
572 *
573 * @access public
574 * @param string the table name
575 * @param array the where clause
576 * @param string the limit clause
577 * @return string
Barry Mienydd671972010-10-04 16:33:58 +0200578 */
Derek Allard2067d1a2008-11-13 22:59:24 +0000579 function _delete($table, $where = array(), $like = array(), $limit = FALSE)
580 {
581 $conditions = '';
582
583 if (count($where) > 0 OR count($like) > 0)
584 {
585 $conditions = "\nWHERE ";
586 $conditions .= implode("\n", $this->ar_where);
587
588 if (count($where) > 0 && count($like) > 0)
589 {
590 $conditions .= " AND ";
591 }
592 $conditions .= implode("\n", $like);
593 }
594
595 $limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
Barry Mienydd671972010-10-04 16:33:58 +0200596
Derek Allard2067d1a2008-11-13 22:59:24 +0000597 return "DELETE FROM ".$table.$conditions.$limit;
598 }
Barry Mienydd671972010-10-04 16:33:58 +0200599
Derek Allard2067d1a2008-11-13 22:59:24 +0000600 // --------------------------------------------------------------------
601
602 /**
603 * Limit string
604 *
605 * Generates a platform-specific LIMIT clause
606 *
607 * @access public
608 * @param string the sql query string
609 * @param integer the number of rows to limit the query to
610 * @param integer the offset value
611 * @return string
612 */
613 function _limit($sql, $limit, $offset)
Barry Mienydd671972010-10-04 16:33:58 +0200614 {
Derek Allard2067d1a2008-11-13 22:59:24 +0000615 if ($offset == 0)
616 {
617 $offset = '';
618 }
619 else
620 {
621 $offset .= ", ";
622 }
Barry Mienydd671972010-10-04 16:33:58 +0200623
Derek Allard2067d1a2008-11-13 22:59:24 +0000624 return $sql."LIMIT ".$offset.$limit;
625 }
626
627 // --------------------------------------------------------------------
628
629 /**
630 * Close DB Connection
631 *
632 * @access public
633 * @param resource
634 * @return void
635 */
636 function _close($conn_id)
637 {
638 @sqlite_close($conn_id);
639 }
640
641
642}
643
644
645/* End of file sqlite_driver.php */
Andrey Andreev063f5962012-02-27 12:20:52 +0200646/* Location: ./system/database/drivers/sqlite/sqlite_driver.php */