diff options
author | admin <devnull@localhost> | 2006-10-01 05:38:04 +0200 |
---|---|---|
committer | admin <devnull@localhost> | 2006-10-01 05:38:04 +0200 |
commit | b2a9ceccdb85050cb494e6d0a98b0a49495d29bb (patch) | |
tree | 16307166046e516304e5d38a072b6e8534657927 /system/database/DB_utility.php | |
parent | 0e42554740e2256eb9bf33bfb2f91788a99a1348 (diff) |
Diffstat (limited to 'system/database/DB_utility.php')
-rw-r--r-- | system/database/DB_utility.php | 29 |
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 |