Take two:
[www-register-wizard.git] / database / drivers / sqlite / sqlite_utility.php
1 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');\r
2 /**\r
3  * CodeIgniter\r
4  *\r
5  * An open source application development framework for PHP 4.3.2 or newer\r
6  *\r
7  * @package             CodeIgniter\r
8  * @author              ExpressionEngine Dev Team\r
9  * @copyright   Copyright (c) 2008, EllisLab, Inc.\r
10  * @license             http://codeigniter.com/user_guide/license.html\r
11  * @link                http://codeigniter.com\r
12  * @since               Version 1.0\r
13  * @filesource\r
14  */\r
15 \r
16 // ------------------------------------------------------------------------\r
17 \r
18 /**\r
19  * SQLite Utility Class\r
20  *\r
21  * @category    Database\r
22  * @author              ExpressionEngine Dev Team\r
23  * @link                http://codeigniter.com/user_guide/database/\r
24  */\r
25 class CI_DB_sqlite_utility extends CI_DB_utility {\r
26 \r
27         /**\r
28          * List databases\r
29          *\r
30          * I don't believe you can do a database listing with SQLite\r
31          * since each database is its own file.  I suppose we could\r
32          * try reading a directory looking for SQLite files, but\r
33          * that doesn't seem like a terribly good idea\r
34          *\r
35          * @access      private\r
36          * @return      bool\r
37          */\r
38         function _list_databases()\r
39         {\r
40                 if ($this->db_debug)\r
41                 {\r
42                         return $this->display_error('db_unsuported_feature');\r
43                 }\r
44                 return array();\r
45         }\r
46 \r
47         // --------------------------------------------------------------------\r
48 \r
49         /**\r
50          * Optimize table query\r
51          *\r
52          * Is optimization even supported in SQLite?\r
53          *\r
54          * @access      private\r
55          * @param       string  the table name\r
56          * @return      object\r
57          */\r
58         function _optimize_table($table)\r
59         {\r
60                 return FALSE;\r
61         }\r
62 \r
63         // --------------------------------------------------------------------\r
64 \r
65         /**\r
66          * Repair table query\r
67          *\r
68          * Are table repairs even supported in SQLite?\r
69          *\r
70          * @access      private\r
71          * @param       string  the table name\r
72          * @return      object\r
73          */\r
74         function _repair_table($table)\r
75         {\r
76                 return FALSE;\r
77         }\r
78 \r
79         // --------------------------------------------------------------------\r
80 \r
81         /**\r
82          * SQLite Export\r
83          *\r
84          * @access      private\r
85          * @param       array   Preferences\r
86          * @return      mixed\r
87          */\r
88         function _backup($params = array())\r
89         {\r
90                 // Currently unsupported\r
91                 return $this->db->display_error('db_unsuported_feature');\r
92         }\r
93 \r
94         /**\r
95          *\r
96          * The functions below have been deprecated as of 1.6, and are only here for backwards\r
97          * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation\r
98          * is STRONGLY discouraged in favour if using dbforge.\r
99          *\r
100          */\r
101 \r
102         /**\r
103          * Create database\r
104          *\r
105          * @access      public\r
106          * @param       string  the database name\r
107          * @return      bool\r
108          */\r
109         function _create_database()\r
110         {\r
111                 // In SQLite, a database is created when you connect to the database.\r
112                 // We'll return TRUE so that an error isn't generated\r
113                 return TRUE;\r
114         }\r
115 \r
116         // --------------------------------------------------------------------\r
117 \r
118         /**\r
119          * Drop database\r
120          *\r
121          * @access      private\r
122          * @param       string  the database name\r
123          * @return      bool\r
124          */\r
125         function _drop_database($name)\r
126         {\r
127                 if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))\r
128                 {\r
129                         if ($this->db->db_debug)\r
130                         {\r
131                                 return $this->db->display_error('db_unable_to_drop');\r
132                         }\r
133                         return FALSE;\r
134                 }\r
135                 return TRUE;\r
136         }\r
137 \r
138 }\r
139 \r
140 /* End of file sqlite_utility.php */\r
141 /* Location: ./system/database/drivers/sqlite/sqlite_utility.php */