diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index d96fffa..b17b3d5 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -211,13 +211,6 @@
-
-
-
- function show_databases()
- {
- }
-
function create_table()
{
}
diff --git a/system/database/drivers/mssql/mssql_utility.php b/system/database/drivers/mssql/mssql_utility.php
index 9ff92d4..bc398e7 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -52,6 +52,29 @@
}
// --------------------------------------------------------------------
+
+ /**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ 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;
+ }
+
+ // --------------------------------------------------------------------
/**
* Version number query string
diff --git a/system/database/drivers/mysql/mysql_utility.php b/system/database/drivers/mysql/mysql_utility.php
index d4e9786..5bbf468 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -53,6 +53,29 @@
// --------------------------------------------------------------------
/**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ 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;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Version number query string
*
* @access public
diff --git a/system/database/drivers/mysqli/mysqli_utility.php b/system/database/drivers/mysqli/mysqli_utility.php
index 9c773b4..14a6ef8 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -53,6 +53,29 @@
// --------------------------------------------------------------------
/**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ 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;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* 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 35b753e..03edcb2 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -34,7 +34,6 @@
*/
function create_database($name)
{
-
}
// --------------------------------------------------------------------
@@ -48,7 +47,18 @@
*/
function drop_database($name)
{
+ }
+ // --------------------------------------------------------------------
+
+ /**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ function list_databases()
+ {
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/odbc/odbc_utility.php b/system/database/drivers/odbc/odbc_utility.php
index 51fec8e..42537de 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -36,6 +36,10 @@
{
// ODBC has no "create database" command since it's
// designed to connect to an existing database
+ if ($this->db_debug)
+ {
+ return $this->display_error('db_unsuported_feature');
+ }
return FALSE;
}
@@ -51,7 +55,29 @@
function drop_database($name)
{
// ODBC has no "drop database" command since it's
- // designed to connect to an existing database
+ // designed to connect to an existing database
+ if ($this->db_debug)
+ {
+ return $this->display_error('db_unsuported_feature');
+ }
+ return FALSE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ function list_databases()
+ {
+ // Not sure if ODBC lets you list all databases...
+ if ($this->db_debug)
+ {
+ return $this->display_error('db_unsuported_feature');
+ }
return FALSE;
}
diff --git a/system/database/drivers/postgre/postgre_utility.php b/system/database/drivers/postgre/postgre_utility.php
index c38cf6e..103f8d5 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -54,6 +54,29 @@
// --------------------------------------------------------------------
/**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ 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;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* 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 8cbf0d5..5f1f02e 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -63,6 +63,23 @@
// --------------------------------------------------------------------
/**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ function list_databases()
+ {
+ if ($this->db_debug)
+ {
+ return $this->display_error('db_unsuported_feature');
+ }
+ return array();
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Version number query string
*
* @access public
diff --git a/system/language/english/db_lang.php b/system/language/english/db_lang.php
index a3d0900..5be7d6e 100644
--- a/system/language/english/db_lang.php
+++ b/system/language/english/db_lang.php
@@ -13,6 +13,7 @@
$lang['db_unsupported_function'] = 'This feature is not available for the database you are using.';
$lang['db_transaction_failure'] = 'Transaction failure: Rollback performed';
$lang['db_unable_to_drop'] = 'Unable to drop the specified database.';
+$lang['db_unsuported_feature'] = 'Unsupported feature of the database platform you are using.';
?>
\ No newline at end of file