diff options
author | admin <devnull@localhost> | 2006-09-29 03:14:52 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-09-29 03:14:52 +0200 |
commit | 4a2ed69c3af500ca51bddcc9b6c54bebb2bfeae8 (patch) | |
tree | ec71c7c2ab01800356df68c0d90b1215b7b7e9f1 | |
parent | ee54c112bfb488f833fa032758b817e1bb2c1d7d (diff) |
-rw-r--r-- | system/codeigniter/Common.php | 31 | ||||
-rw-r--r-- | system/database/drivers/oci8/oci8_utility.php | 2 | ||||
-rw-r--r-- | system/database/drivers/postgre/postgre_utility.php | 8 | ||||
-rw-r--r-- | system/database/drivers/sqlite/sqlite_utility.php | 19 | ||||
-rw-r--r-- | system/libraries/Controller.php | 1 |
5 files changed, 39 insertions, 22 deletions
diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php index 24e6042cc..124ad9a38 100644 --- a/system/codeigniter/Common.php +++ b/system/codeigniter/Common.php @@ -37,6 +37,8 @@ * previously been instantiated the variable is returned. * * @access public +* @param string the class name being requested +* @param bool optional flag that lets classes get loaded but not instantiated * @return object */ function &_load_class($class, $instantiate = TRUE) @@ -58,7 +60,7 @@ function &_load_class($class, $instantiate = TRUE) // If the requested class does not exist in the application/libraries // folder we'll load the native class from the system/libraries folder. - + $is_subclass = FALSE; if ( ! file_exists(APPPATH.'libraries/'.$class.EXT)) { @@ -67,20 +69,27 @@ function &_load_class($class, $instantiate = TRUE) else { // A core class can either be extended or replaced by putting an - // identially named file in the application/libraries folder. - // We need to need to determine if the class being requested is - // a sub-class or an independent instance so we'll open the file, - // read the top portion of it. If the class extends the base class - // we need to load it's parent. If it doesn't extend the base we'll - // only load the requested class. + // identically named file in the application/libraries folder. + // We need to determine, however, if the class being requested is + // a sub-class of an existing library or an independent instance + // since each needs to be handled slightly differently. + // To do this we'll open the requested class and read the top portion + // of it. If the class extends a base class we will load the base first. + // If it doesn't extend the base we'll only load the requested class. // Note: I'm not thrilled with this approach since it requires us to - // read the file, but I can't think of any other way to allow classes - // to be extended on-the-fly. I did benchmark the difference with and - // without the file reading and I'm not seeing a perceptable difference. + // read the top part of the file (I set a character limit of 5000 bytes, + // which correlates to roughly the first 100 lines of code), but + // I can't think of a better way to allow classes to be extended or + // replaced on-the-fly with nothing required for the user to do + // except write the declaration. Fortunately PHP is ridiculously fast + // at file reading operations so I'm not able to discern a performance + // hit based on my benchmarks, assuming a reasonable number of core + // files are being extended, which will usually be the case. $fp = fopen(APPPATH.'libraries/'.$class.EXT, "rb"); - if (preg_match("/MY_".$class."\s+extends\s+CI_".$class."/", fread($fp, '8000'))) + + if (preg_match("/MY_".$class."\s+extends\s+CI_".$class."/", fread($fp, '6000'))) { require(BASEPATH.'libraries/'.$class.EXT); require(APPPATH.'libraries/'.$class.EXT); diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php index dc259ac39..4d267dc6a 100644 --- a/system/database/drivers/oci8/oci8_utility.php +++ b/system/database/drivers/oci8/oci8_utility.php @@ -76,7 +76,7 @@ class CI_DB_oci8_utility extends CI_DB_utility { */ function _list_tables() { - return "select TABLE_NAME FROM ALL_TABLES"; + return "SELECT TABLE_NAME FROM ALL_TABLES"; } // -------------------------------------------------------------------- diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php index 0ee448f9e..7b51c3fe7 100644 --- a/system/database/drivers/postgre/postgre_utility.php +++ b/system/database/drivers/postgre/postgre_utility.php @@ -97,7 +97,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { /** * Optimize table query * - * Generates a platform-specific query so that a table can be optimized + * Is table optimization supported in Postgre? * * @access private * @param string the table name @@ -105,7 +105,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { */ function _optimize_table($table) { - return FALSE; // Is this supported in Postgre? + return FALSE; } // -------------------------------------------------------------------- @@ -113,7 +113,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { /** * Repair table query * - * Generates a platform-specific query so that a table can be repaired + * Are table repairs supported in Postgre? * * @access private * @param string the table name @@ -121,7 +121,7 @@ class CI_DB_postgre_utility extends CI_DB_utility { */ function _repair_table($table) { - return return FALSE; // Is this supported in Postgre? + return return FALSE; } diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php index 43c43e03c..ae241db87 100644 --- a/system/database/drivers/sqlite/sqlite_utility.php +++ b/system/database/drivers/sqlite/sqlite_utility.php @@ -34,7 +34,8 @@ class CI_DB_sqlite_utility extends CI_DB_utility { */ function _create_database() { - // In SQLite, a database is created when you connect to the database + // In SQLite, a database is created when you connect to the database. + // We'll return TRUE so that an error isn't generated return TRUE; } @@ -65,11 +66,17 @@ class CI_DB_sqlite_utility extends CI_DB_utility { /** * List databases * + * I don't believe you can do a database listing with SQLite + * since each database is its own file. I suppose we could + * try reading a directory looking for SQLite files, but + * that doesn't seem like a terribly good idea + * * @access private * @return bool */ function _list_databases() { + if ($this->db_debug) { return $this->display_error('db_unsuported_feature'); @@ -97,6 +104,8 @@ class CI_DB_sqlite_utility extends CI_DB_utility { /** * Drop Table * + * Unsupported feature in SQLite + * * @access private * @return bool */ @@ -114,7 +123,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility { /** * Optimize table query * - * Generates a platform-specific query so that a table can be optimized + * Is optimization even supported in SQLite? * * @access private * @param string the table name @@ -122,7 +131,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility { */ function _optimize_table($table) { - return FALSE; // Is this supported SQLite? + return FALSE; } // -------------------------------------------------------------------- @@ -130,7 +139,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility { /** * Repair table query * - * Generates a platform-specific query so that a table can be repaired + * Are table repairs even supported in SQLite? * * @access private * @param string the table name @@ -138,7 +147,7 @@ class CI_DB_sqlite_utility extends CI_DB_utility { */ function _repair_table($table) { - return return FALSE; // Is this supported in SQLite? + return return FALSE; } diff --git a/system/libraries/Controller.php b/system/libraries/Controller.php index ff914d131..be66b19b7 100644 --- a/system/libraries/Controller.php +++ b/system/libraries/Controller.php @@ -191,7 +191,6 @@ class Controller extends CI_Base { $remap = array( 'DB_export' => 'dbexport', 'DB_utility' => 'dbutility', - 'Encryption' => 'encrypt', 'Unit_test' => 'unit' ); |