summaryrefslogtreecommitdiffstats
path: root/system/database
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-25 04:51:08 +0200
committeradmin <devnull@localhost>2006-09-25 04:51:08 +0200
commit6ca6f9471ba31f7cba9054d075b4f90382b2d410 (patch)
tree80bac9d110b8c9a907600e6450e2e241e2a5ccd7 /system/database
parenta5e812c007b8dfbc4c117df379d63060f08b096a (diff)
Diffstat (limited to 'system/database')
-rw-r--r--system/database/DB_utility.php6
-rw-r--r--system/database/drivers/mssql/mssql_utility.php28
-rw-r--r--system/database/drivers/mysql/mysql_utility.php28
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php28
-rw-r--r--system/database/drivers/oci8/oci8_utility.php27
-rw-r--r--system/database/drivers/odbc/odbc_utility.php33
-rw-r--r--system/database/drivers/postgre/postgre_utility.php28
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php38
8 files changed, 210 insertions, 6 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index c43b39950..d96fffa04 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -212,13 +212,7 @@ class CI_DB_utility {
- function create_database()
- {
- }
- function drop_database()
- {
- }
function show_databases()
{
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 96d112805..9ff92d41b 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -24,6 +24,34 @@
*/
class CI_DB_mssql_utility extends CI_DB_utility {
+
+ /**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database($name)
+ {
+ return $this->db->query("CREATE DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+ return $this->db->query("DROP DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
/**
* Version number query string
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index 9bf2f5aa9..d4e97867a 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -24,6 +24,33 @@
*/
class CI_DB_mysql_utility extends CI_DB_utility {
+ /**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database($name)
+ {
+ return $this->db->query("CREATE DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+ return $this->db->query("DROP DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
/**
* Version number query string
@@ -86,6 +113,7 @@ class CI_DB_mysql_utility extends CI_DB_utility {
}
+
}
?> \ No newline at end of file
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index a1498a33d..9c773b4b9 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -25,6 +25,34 @@
class CI_DB_mysqli_utility extends CI_DB_utility {
/**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database($name)
+ {
+ return $this->db->query("CREATE DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+ return $this->db->query("DROP DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Version number query string
*
* @access public
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index fdd585d98..35b753ec6 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -25,6 +25,33 @@
class CI_DB_oci8_utility extends CI_DB_utility {
+ /**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database($name)
+ {
+
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+
+ }
+
+ // --------------------------------------------------------------------
/**
* Version number query string
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 837c8c881..51fec8eed 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -24,6 +24,39 @@
*/
class CI_DB_odbc_utility extends CI_DB_utility {
+
+ /**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database($name)
+ {
+ // ODBC has no "create database" command since it's
+ // designed to connect to an existing database
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+ // ODBC has no "drop database" command since it's
+ // designed to connect to an existing database
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
/**
* Version number query string
*
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index cfc475f6b..c38cf6e69 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -26,6 +26,34 @@ class CI_DB_postgre_utility extends CI_DB_utility {
/**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database($name)
+ {
+ return $this->db->query("CREATE DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+ return $this->db->query("DROP DATABASE ".$this->db->_escape_table($name));
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Version number query string
*
* @access public
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 2b99df907..8cbf0d56d 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -24,6 +24,44 @@
*/
class CI_DB_sqlite_utility extends CI_DB_utility {
+
+ /**
+ * Create database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function create_database()
+ {
+ // In SQLite, a database is created when you connect to the database
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
+ {
+ if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
+ {
+ if ($this->db_debug)
+ {
+ return $this->display_error('db_unable_to_drop');
+ }
+ return FALSE;
+ }
+ return TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
/**
* Version number query string
*