blob: 801660d94310d257cd84dc286f8375f3db8daedd [file] [log] [blame]
admin7b613c72006-09-24 18:05:17 +00001<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * Code Igniter
4 *
5 * An open source application development framework for PHP 4.3.2 or newer
6 *
7 * @package CodeIgniter
8 * @author Rick Ellis
9 * @copyright Copyright (c) 2006, pMachine, Inc.
10 * @license http://www.codeignitor.com/user_guide/license.html
11 * @link http://www.codeigniter.com
12 * @since Version 1.0
13 * @filesource
14 */
15
16// ------------------------------------------------------------------------
17
18/**
19 * SQLite Utility Class
20 *
21 * @category Database
22 * @author Rick Ellis
23 * @link http://www.codeigniter.com/user_guide/database/
24 */
admina5e812c2006-09-25 02:17:30 +000025class CI_DB_sqlite_utility extends CI_DB_utility {
26
admin6ca6f942006-09-25 02:51:08 +000027
28 /**
29 * Create database
30 *
31 * @access public
32 * @param string the database name
33 * @return bool
34 */
admin6cec6a52006-09-25 06:56:49 +000035 function _create_database()
admin6ca6f942006-09-25 02:51:08 +000036 {
admin4a2ed692006-09-29 01:14:52 +000037 // In SQLite, a database is created when you connect to the database.
38 // We'll return TRUE so that an error isn't generated
admin6ca6f942006-09-25 02:51:08 +000039 return TRUE;
40 }
41
42 // --------------------------------------------------------------------
43
44 /**
45 * Drop database
46 *
admin83b05a82006-09-25 21:06:46 +000047 * @access private
admin6ca6f942006-09-25 02:51:08 +000048 * @param string the database name
49 * @return bool
50 */
admin83b05a82006-09-25 21:06:46 +000051 function _drop_database($name)
admin6ca6f942006-09-25 02:51:08 +000052 {
53 if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
54 {
admin3dd978f2006-09-30 19:24:45 +000055 if ($this->db->db_debug)
admin6ca6f942006-09-25 02:51:08 +000056 {
admin3dd978f2006-09-30 19:24:45 +000057 return $this->db->display_error('db_unable_to_drop');
admin6ca6f942006-09-25 02:51:08 +000058 }
59 return FALSE;
60 }
61 return TRUE;
62 }
63
64 // --------------------------------------------------------------------
65
admin7b613c72006-09-24 18:05:17 +000066 /**
admin4ceac2d2006-09-25 06:40:16 +000067 * Drop Table
68 *
admin4a2ed692006-09-29 01:14:52 +000069 * Unsupported feature in SQLite
70 *
admin83b05a82006-09-25 21:06:46 +000071 * @access private
admin4ceac2d2006-09-25 06:40:16 +000072 * @return bool
73 */
admin83b05a82006-09-25 21:06:46 +000074 function _drop_table($table)
admin4ceac2d2006-09-25 06:40:16 +000075 {
admin3dd978f2006-09-30 19:24:45 +000076 if ($this->db->db_debug)
admin4ceac2d2006-09-25 06:40:16 +000077 {
admin3dd978f2006-09-30 19:24:45 +000078 return $this->db->display_error('db_unsuported_feature');
admin4ceac2d2006-09-25 06:40:16 +000079 }
80 return array();
81 }
82
83 // --------------------------------------------------------------------
84
85 /**
adminab4f61b2006-09-25 22:12:32 +000086 * Optimize table query
87 *
admin4a2ed692006-09-29 01:14:52 +000088 * Is optimization even supported in SQLite?
adminab4f61b2006-09-25 22:12:32 +000089 *
90 * @access private
91 * @param string the table name
92 * @return object
93 */
94 function _optimize_table($table)
95 {
admin4a2ed692006-09-29 01:14:52 +000096 return FALSE;
adminab4f61b2006-09-25 22:12:32 +000097 }
98
99 // --------------------------------------------------------------------
100
101 /**
102 * Repair table query
103 *
admin4a2ed692006-09-29 01:14:52 +0000104 * Are table repairs even supported in SQLite?
adminab4f61b2006-09-25 22:12:32 +0000105 *
106 * @access private
107 * @param string the table name
108 * @return object
109 */
110 function _repair_table($table)
111 {
admin4a2ed692006-09-29 01:14:52 +0000112 return return FALSE;
adminab4f61b2006-09-25 22:12:32 +0000113 }
admina5e812c2006-09-25 02:17:30 +0000114
115
admin7b613c72006-09-24 18:05:17 +0000116}
117
118?>