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