From d947eba0bdaf9d86401fdcba9e97706905cacf9d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 9 Apr 2012 14:58:28 +0300 Subject: Multiple DB Forge improvements - Replaced driver methods _create_database(), _drop_database(), _drop_table() and _rename_table() with properties - Added defaults for the above mentioned platform-specific queries, so that not all drivers need to define them - Improved support for the SQLite, ODBC and PDO drivers --- system/database/drivers/mysql/mysql_forge.php | 55 +-------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) (limited to 'system/database/drivers/mysql') diff --git a/system/database/drivers/mysql/mysql_forge.php b/system/database/drivers/mysql/mysql_forge.php index 9e19de1bb..e5c0f8068 100644 --- a/system/database/drivers/mysql/mysql_forge.php +++ b/system/database/drivers/mysql/mysql_forge.php @@ -34,31 +34,7 @@ */ class CI_DB_mysql_forge extends CI_DB_forge { - /** - * Create database - * - * @param string the database name - * @return string - */ - public function _create_database($name) - { - return 'CREATE DATABASE '.$name.' CHARACTER SET '.$this->db->char_set.' COLLATE '.$this->db->dbcollat; - } - - // -------------------------------------------------------------------- - - /** - * Drop database - * - * @param string the database name - * @return string - */ - public function _drop_database($name) - { - return 'DROP DATABASE '.$name; - } - - // -------------------------------------------------------------------- + protected $_create_database = 'CREATE DATABASE %s CHARACTER SET %s COLLATE %s'; /** * Process Fields @@ -179,19 +155,6 @@ class CI_DB_mysql_forge extends CI_DB_forge { // -------------------------------------------------------------------- - /** - * Drop Table - * - * @param string table name - * @return string - */ - public function _drop_table($table) - { - return 'DROP TABLE IF EXISTS '.$this->db->protect_identifiers($table); - } - - // -------------------------------------------------------------------- - /** * Alter table query * @@ -218,22 +181,6 @@ class CI_DB_mysql_forge extends CI_DB_forge { .($after_field != '' ? ' AFTER '.$this->db->protect_identifiers($after_field) : ''); } - // -------------------------------------------------------------------- - - /** - * Rename a table - * - * Generates a platform-specific query so that a table can be renamed - * - * @param string the old table name - * @param string the new table name - * @return string - */ - public function _rename_table($table_name, $new_table_name) - { - return 'ALTER TABLE '.$this->db->protect_identifiers($table_name).' RENAME TO '.$this->db->protect_identifiers($new_table_name); - } - } /* End of file mysql_forge.php */ -- cgit v1.2.3-24-g4f1b