summaryrefslogtreecommitdiffstats
path: root/system/database/DB_utility.php
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2010-02-04 18:45:47 +0100
committerDerek Allard <derek.allard@ellislab.com>2010-02-04 18:45:47 +0100
commit62396232658467b463f37e55bec159aadc188edd (patch)
tree207cd68f1a110ea00eba9f160049441ceb5c940b /system/database/DB_utility.php
parentdd58ff6d2b5bd2a6f5f2a6aed0b1d5949b3aafd2 (diff)
database_exists extension to allow for databases without list_databases() functionality
Diffstat (limited to 'system/database/DB_utility.php')
-rw-r--r--system/database/DB_utility.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index af62dcf3d..124967a5a 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -82,10 +82,21 @@ class CI_DB_utility extends CI_DB_forge {
* @return boolean
*/
function database_exists($database_name)
- {
- return ( ! in_array($database_name, $this->list_databases())) ? FALSE : TRUE;
+ {
+ // Some databases won't have access to the list_databases() function, so
+ // this is intended to allow them to override with their own functions as
+ // defined in $driver_utility.php
+ if (method_exists($this, '_database_exists'))
+ {
+ return $this->_database_exists($database_name);
+ }
+ else
+ {
+ return ( ! in_array($database_name, $this->list_databases())) ? FALSE : TRUE;
+ }
}
+
// --------------------------------------------------------------------
/**