blob: 43c43e03c24c1845f76fb197a75dce4c198c2464 [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 {
37 // In SQLite, a database is created when you connect to the database
38 return TRUE;
39 }
40
41 // --------------------------------------------------------------------
42
43 /**
44 * Drop database
45 *
admin83b05a82006-09-25 21:06:46 +000046 * @access private
admin6ca6f942006-09-25 02:51:08 +000047 * @param string the database name
48 * @return bool
49 */
admin83b05a82006-09-25 21:06:46 +000050 function _drop_database($name)
admin6ca6f942006-09-25 02:51:08 +000051 {
52 if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
53 {
54 if ($this->db_debug)
55 {
56 return $this->display_error('db_unable_to_drop');
57 }
58 return FALSE;
59 }
60 return TRUE;
61 }
62
63 // --------------------------------------------------------------------
64
admin7b613c72006-09-24 18:05:17 +000065 /**
admin72496372006-09-25 03:44:04 +000066 * List databases
67 *
admin83b05a82006-09-25 21:06:46 +000068 * @access private
admin72496372006-09-25 03:44:04 +000069 * @return bool
70 */
admin83b05a82006-09-25 21:06:46 +000071 function _list_databases()
admin72496372006-09-25 03:44:04 +000072 {
73 if ($this->db_debug)
74 {
75 return $this->display_error('db_unsuported_feature');
76 }
77 return array();
78 }
79
80 // --------------------------------------------------------------------
81
82 /**
admin9cd4e8e2006-09-25 23:26:25 +000083 * Show table query
84 *
85 * Generates a platform-specific query string so that the table names can be fetched
86 *
87 * @access private
88 * @return string
89 */
90 function _list_tables()
91 {
92 return "SELECT name from sqlite_master WHERE type='table'";
93 }
94
95 // --------------------------------------------------------------------
96
97 /**
admin4ceac2d2006-09-25 06:40:16 +000098 * Drop Table
99 *
admin83b05a82006-09-25 21:06:46 +0000100 * @access private
admin4ceac2d2006-09-25 06:40:16 +0000101 * @return bool
102 */
admin83b05a82006-09-25 21:06:46 +0000103 function _drop_table($table)
admin4ceac2d2006-09-25 06:40:16 +0000104 {
105 if ($this->db_debug)
106 {
107 return $this->display_error('db_unsuported_feature');
108 }
109 return array();
110 }
111
112 // --------------------------------------------------------------------
113
114 /**
adminab4f61b2006-09-25 22:12:32 +0000115 * Optimize table query
116 *
117 * Generates a platform-specific query so that a table can be optimized
118 *
119 * @access private
120 * @param string the table name
121 * @return object
122 */
123 function _optimize_table($table)
124 {
125 return FALSE; // Is this supported SQLite?
126 }
127
128 // --------------------------------------------------------------------
129
130 /**
131 * Repair table query
132 *
133 * Generates a platform-specific query so that a table can be repaired
134 *
135 * @access private
136 * @param string the table name
137 * @return object
138 */
139 function _repair_table($table)
140 {
141 return return FALSE; // Is this supported in SQLite?
142 }
admina5e812c2006-09-25 02:17:30 +0000143
144
admin7b613c72006-09-24 18:05:17 +0000145}
146
147?>