diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 128984d..36d74c5 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -232,14 +232,70 @@
// --------------------------------------------------------------------
-
-
-
-
-
- function create_table()
+ /**
+ * Drop database
+ *
+ * @access public
+ * @param string the database name
+ * @return bool
+ */
+ function drop_database($name)
{
+ $sql = $this->_drop_database($name);
+
+ if (is_bool($sql))
+ {
+ return $sql;
+ }
+
+ return $this->db->query($sql);
}
+
+ // --------------------------------------------------------------------
+
+ /**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ function list_databases()
+ {
+ $query = $this->db->query($this->_list_database());
+ $dbs = array();
+ if ($query->num_rows() > 0)
+ {
+ foreach ($query->result_array() as $row)
+ {
+ $dbs[] = current($row);
+ }
+ }
+
+ return $dbs;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Drop Table
+ *
+ * @access public
+ * @param string the table name
+ * @return bool
+ */
+ function drop_table($name)
+ {
+ $sql = $this->_drop_table($name);
+
+ if (is_bool($sql))
+ {
+ return $sql;
+ }
+
+ return $this->db->query($sql);
+ }
+
+
function alter_table()
{
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 49b63b7..b85a420 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -42,13 +42,13 @@
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -56,22 +56,12 @@
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("EXEC sp_helpdb"); // Can also be: EXEC sp_databases
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "EXEC sp_helpdb"; // Can also be: EXEC sp_databases
}
// --------------------------------------------------------------------
@@ -79,12 +69,12 @@
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE ".$this->db->_escape_table($name));
+ return "DROP TABLE ".$this->db->_escape_table($name);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index e5f8e85..a0c7462 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -41,13 +41,13 @@
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -55,22 +55,12 @@
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("SHOW DATABASES");
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "SHOW DATABASES";
}
// --------------------------------------------------------------------
@@ -78,12 +68,12 @@
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE IF EXISTS ".$this->db->_escape_table($name));
+ return "DROP TABLE IF EXISTS ".$this->db->_escape_table($name);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 1775047..3286618 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -41,13 +41,13 @@
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -55,22 +55,12 @@
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("SHOW DATABASES");
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "SHOW DATABASES";
}
// --------------------------------------------------------------------
@@ -78,12 +68,12 @@
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE IF EXISTS ".$this->db->_escape_table($name));
+ return "DROP TABLE IF EXISTS ".$this->db->_escape_table($name);
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/oci8/oci8_utility.php b/system/database/drivers/oci8/oci8_utility.php
index 74b0165..9c3059f 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -34,6 +34,7 @@
*/
function _create_database($name)
{
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -41,12 +42,13 @@
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -54,11 +56,12 @@
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -66,11 +69,12 @@
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
+ return FALSE;
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 74f8d39..5b4558f 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -48,11 +48,11 @@
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
// ODBC has no "drop database" command since it's
// designed to connect to an existing database
@@ -68,10 +68,10 @@
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
// Not sure if ODBC lets you list all databases...
if ($this->db_debug)
@@ -86,10 +86,10 @@
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
// Not a supported ODBC feature
if ($this->db_debug)
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index 8e51623..b31609a 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -42,13 +42,13 @@
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
- return $this->db->query("DROP DATABASE ".$name);
+ return "DROP DATABASE ".$name;
}
// --------------------------------------------------------------------
@@ -56,22 +56,12 @@
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
- $query = $this->db->query("SELECT datname FROM pg_database");
- $dbs = array();
- if ($query->num_rows() > 0)
- {
- foreach ($query->result_array() as $row)
- {
- $dbs[] = current($row);
- }
- }
-
- return $dbs;
+ return "SELECT datname FROM pg_database";
}
// --------------------------------------------------------------------
@@ -79,12 +69,12 @@
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
- return $this->db->query("DROP TABLE ".$this->db->_escape_table($name)." CASCADE");
+ return "DROP TABLE ".$this->db->_escape_table($name)." CASCADE";
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite/sqlite_utility.php b/system/database/drivers/sqlite/sqlite_utility.php
index 14b406a..754a755 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -43,11 +43,11 @@
/**
* Drop database
*
- * @access public
+ * @access private
* @param string the database name
* @return bool
*/
- function drop_database($name)
+ function _drop_database($name)
{
if ( ! @file_exists($this->db->database) OR ! @unlink($this->db->database))
{
@@ -65,10 +65,10 @@
/**
* List databases
*
- * @access public
+ * @access private
* @return bool
*/
- function list_databases()
+ function _list_databases()
{
if ($this->db_debug)
{
@@ -82,10 +82,10 @@
/**
* Drop Table
*
- * @access public
+ * @access private
* @return bool
*/
- function drop_table($table)
+ function _drop_table($table)
{
if ($this->db_debug)
{