blob: 85e74d05fcc5814d2e2dffedcf4daa8c42767bb2 [file] [log] [blame]
Derek Allardd2df9bc2007-04-15 17:41:17 +00001<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2/**
3 * CodeIgniter
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, EllisLab, Inc.
Derek Allard6838f002007-10-04 19:29:59 +000010 * @license http://www.codeigniter.com/user_guide/license.html
Derek Allardd2df9bc2007-04-15 17:41:17 +000011 * @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 */
25class CI_DB_sqlite_utility extends CI_DB_utility {
26
27
28 /**
29 * Create database
30 *
31 * @access public
32 * @param string the database name
33 * @return bool
34 */
35 function _create_database()
36 {
37 // In SQLite, a database is created when you connect to the database.
38 // We'll return TRUE so that an error isn't generated
39 return TRUE;
40 }
41
42 // --------------------------------------------------------------------
43
44 /**
45 * Drop database
46 *
47 * @access private
48 * @param string the database name
49 * @return bool
50 */
51 function _drop_database($name)
52 {
53 if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
54 {
55 if ($this->db->db_debug)
56 {
57 return $this->db->display_error('db_unable_to_drop');
58 }
59 return FALSE;
60 }
61 return TRUE;
62 }
63
64 // --------------------------------------------------------------------
65
66 /**
67 * List databases
68 *
69 * I don't believe you can do a database listing with SQLite
70 * since each database is its own file. I suppose we could
71 * try reading a directory looking for SQLite files, but
72 * that doesn't seem like a terribly good idea
73 *
74 * @access private
75 * @return bool
76 */
77 function _list_databases()
78 {
79 if ($this->db_debug)
80 {
81 return $this->display_error('db_unsuported_feature');
82 }
83 return array();
84 }
85
86 // --------------------------------------------------------------------
87
88 /**
89 * Drop Table
90 *
91 * Unsupported feature in SQLite
92 *
93 * @access private
94 * @return bool
95 */
96 function _drop_table($table)
97 {
98 if ($this->db->db_debug)
99 {
100 return $this->db->display_error('db_unsuported_feature');
101 }
102 return array();
103 }
104
105 // --------------------------------------------------------------------
106
107 /**
108 * Optimize table query
109 *
110 * Is optimization even supported in SQLite?
111 *
112 * @access private
113 * @param string the table name
114 * @return object
115 */
116 function _optimize_table($table)
117 {
118 return FALSE;
119 }
120
121 // --------------------------------------------------------------------
122
123 /**
124 * Repair table query
125 *
126 * Are table repairs even supported in SQLite?
127 *
128 * @access private
129 * @param string the table name
130 * @return object
131 */
132 function _repair_table($table)
133 {
134 return FALSE;
135 }
136
137 // --------------------------------------------------------------------
138
139 /**
140 * SQLite Export
141 *
142 * @access private
143 * @param array Preferences
144 * @return mixed
145 */
146 function _backup($params = array())
147 {
148 // Currently unsupported
149 return $this->db->display_error('db_unsuported_feature');
150 }
151
152}
153
admin7b613c72006-09-24 18:05:17 +0000154?>