summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/database/DB_utility.php7
-rw-r--r--system/database/drivers/mssql/mssql_utility.php23
-rw-r--r--system/database/drivers/mysql/mysql_utility.php23
-rw-r--r--system/database/drivers/mysqli/mysqli_utility.php23
-rw-r--r--system/database/drivers/oci8/oci8_utility.php12
-rw-r--r--system/database/drivers/odbc/odbc_utility.php28
-rw-r--r--system/database/drivers/postgre/postgre_utility.php23
-rw-r--r--system/database/drivers/sqlite/sqlite_utility.php17
-rw-r--r--system/language/english/db_lang.php1
9 files changed, 148 insertions, 9 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index d96fffa04..b17b3d51c 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -211,13 +211,6 @@ class CI_DB_utility {
-
-
-
- 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 9ff92d41b..bc398e7f7 100644
--- a/system/database/drivers/mssql/mssql_utility.php
+++ b/system/database/drivers/mssql/mssql_utility.php
@@ -52,6 +52,29 @@ class CI_DB_mssql_utility extends CI_DB_utility {
}
// --------------------------------------------------------------------
+
+ /**
+ * 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 d4e97867a..5bbf46810 100644
--- a/system/database/drivers/mysql/mysql_utility.php
+++ b/system/database/drivers/mysql/mysql_utility.php
@@ -53,6 +53,29 @@ class CI_DB_mysql_utility extends CI_DB_utility {
// --------------------------------------------------------------------
/**
+ * 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 9c773b4b9..14a6ef8cf 100644
--- a/system/database/drivers/mysqli/mysqli_utility.php
+++ b/system/database/drivers/mysqli/mysqli_utility.php
@@ -53,6 +53,29 @@ class CI_DB_mysqli_utility extends CI_DB_utility {
// --------------------------------------------------------------------
/**
+ * 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 35b753ec6..03edcb2c8 100644
--- a/system/database/drivers/oci8/oci8_utility.php
+++ b/system/database/drivers/oci8/oci8_utility.php
@@ -34,7 +34,6 @@ class CI_DB_oci8_utility extends CI_DB_utility {
*/
function create_database($name)
{
-
}
// --------------------------------------------------------------------
@@ -48,7 +47,18 @@ class CI_DB_oci8_utility extends CI_DB_utility {
*/
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 51fec8eed..42537de70 100644
--- a/system/database/drivers/odbc/odbc_utility.php
+++ b/system/database/drivers/odbc/odbc_utility.php
@@ -36,6 +36,10 @@ class CI_DB_odbc_utility extends CI_DB_utility {
{
// 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 @@ class CI_DB_odbc_utility extends CI_DB_utility {
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 c38cf6e69..103f8d553 100644
--- a/system/database/drivers/postgre/postgre_utility.php
+++ b/system/database/drivers/postgre/postgre_utility.php
@@ -54,6 +54,29 @@ class CI_DB_postgre_utility extends CI_DB_utility {
// --------------------------------------------------------------------
/**
+ * 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 8cbf0d56d..5f1f02eab 100644
--- a/system/database/drivers/sqlite/sqlite_utility.php
+++ b/system/database/drivers/sqlite/sqlite_utility.php
@@ -63,6 +63,23 @@ class CI_DB_sqlite_utility extends CI_DB_utility {
// --------------------------------------------------------------------
/**
+ * 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 a3d0900d0..5be7d6efb 100644
--- a/system/language/english/db_lang.php
+++ b/system/language/english/db_lang.php
@@ -13,6 +13,7 @@ $lang['db_field_param_missing'] = 'To fetch fields requires the name of the tabl
$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