sqlite_utility.php

Go to the documentation of this file.
00001 <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
00002 /**
00003  * CodeIgniter
00004  *
00005  * An open source application development framework for PHP 4.3.2 or newer
00006  *
00007  * @package             CodeIgniter
00008  * @author              ExpressionEngine Dev Team
00009  * @copyright   Copyright (c) 2008, EllisLab, Inc.
00010  * @license             http://codeigniter.com/user_guide/license.html
00011  * @link                http://codeigniter.com
00012  * @since               Version 1.0
00013  * @filesource
00014  */
00015 
00016 // ------------------------------------------------------------------------
00017 
00018 /**
00019  * SQLite Utility Class
00020  *
00021  * @category    Database
00022  * @author              ExpressionEngine Dev Team
00023  * @link                http://codeigniter.com/user_guide/database/
00024  */
00025 class CI_DB_sqlite_utility extends CI_DB_utility {
00026 
00027         /**
00028          * List databases
00029          *
00030          * I don't believe you can do a database listing with SQLite
00031          * since each database is its own file.  I suppose we could
00032          * try reading a directory looking for SQLite files, but
00033          * that doesn't seem like a terribly good idea
00034          *
00035          * @access      private
00036          * @return      bool
00037          */
00038         function _list_databases()
00039         {
00040                 if ($this->db_debug)
00041                 {
00042                         return $this->display_error('db_unsuported_feature');
00043                 }
00044                 return array();
00045         }
00046 
00047         // --------------------------------------------------------------------
00048 
00049         /**
00050          * Optimize table query
00051          *
00052          * Is optimization even supported in SQLite?
00053          *
00054          * @access      private
00055          * @param       string  the table name
00056          * @return      object
00057          */
00058         function _optimize_table($table)
00059         {
00060                 return FALSE;
00061         }
00062 
00063         // --------------------------------------------------------------------
00064 
00065         /**
00066          * Repair table query
00067          *
00068          * Are table repairs even supported in SQLite?
00069          *
00070          * @access      private
00071          * @param       string  the table name
00072          * @return      object
00073          */
00074         function _repair_table($table)
00075         {
00076                 return FALSE;
00077         }
00078 
00079         // --------------------------------------------------------------------
00080 
00081         /**
00082          * SQLite Export
00083          *
00084          * @access      private
00085          * @param       array   Preferences
00086          * @return      mixed
00087          */
00088         function _backup($params = array())
00089         {
00090                 // Currently unsupported
00091                 return $this->db->display_error('db_unsuported_feature');
00092         }
00093 
00094         /**
00095          *
00096          * The functions below have been deprecated as of 1.6, and are only here for backwards
00097          * compatibility.  They now reside in dbforge().  The use of dbutils for database manipulation
00098          * is STRONGLY discouraged in favour if using dbforge.
00099          *
00100          */
00101 
00102         /**
00103          * Create database
00104          *
00105          * @access      public
00106          * @param       string  the database name
00107          * @return      bool
00108          */
00109         function _create_database()
00110         {
00111                 // In SQLite, a database is created when you connect to the database.
00112                 // We'll return TRUE so that an error isn't generated
00113                 return TRUE;
00114         }
00115 
00116         // --------------------------------------------------------------------
00117 
00118         /**
00119          * Drop database
00120          *
00121          * @access      private
00122          * @param       string  the database name
00123          * @return      bool
00124          */
00125         function _drop_database($name)
00126         {
00127                 if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
00128                 {
00129                         if ($this->db->db_debug)
00130                         {
00131                                 return $this->db->display_error('db_unable_to_drop');
00132                         }
00133                         return FALSE;
00134                 }
00135                 return TRUE;
00136         }
00137 
00138 }
00139 
00140 /* End of file sqlite_utility.php */
00141 /* Location: ./system/database/drivers/sqlite/sqlite_utility.php */