summaryrefslogtreecommitdiffstats
path: root/system/database/DB_utility.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/DB_utility.php')
-rw-r--r--system/database/DB_utility.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index dc56d6524..e568bce02 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -87,6 +87,35 @@ class CI_DB_utility {
// --------------------------------------------------------------------
/**
+ * List databases
+ *
+ * @access public
+ * @return bool
+ */
+ function list_databases()
+ {
+ // Is there a cached result?
+ if (isset($this->cache['db_names']))
+ {
+ return $this->cache['db_names'];
+ }
+
+ $query = $this->db->query($this->_list_database());
+ $dbs = array();
+ if ($query->num_rows() > 0)
+ {
+ foreach ($query->result_array() as $row)
+ {
+ $dbs[] = current($row);
+ }
+ }
+
+ return $this->cache['db_names'] =& $dbs;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Optimize Table
*
* @access public