From 62396232658467b463f37e55bec159aadc188edd Mon Sep 17 00:00:00 2001 From: Derek Allard Date: Thu, 4 Feb 2010 17:45:47 +0000 Subject: database_exists extension to allow for databases without list_databases() functionality --- system/database/DB_utility.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'system/database/DB_utility.php') 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; + } } + // -------------------------------------------------------------------- /** -- cgit v1.2.3-24-g4f1b