From 0d1b8087006aa254ec0229193f44486c3e2014a2 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Tue, 28 Apr 2009 05:33:26 +0000 Subject: [PATCH] MINOR Code formatting fixes --- code/MSSQLDatabase.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/code/MSSQLDatabase.php b/code/MSSQLDatabase.php index 19385ad..0dd3826 100644 --- a/code/MSSQLDatabase.php +++ b/code/MSSQLDatabase.php @@ -210,21 +210,25 @@ class MSSQLDatabase extends Database { */ public function selectDatabase($dbname) { $this->database = $dbname; - if($this->databaseExists($this->database)) mssql_select_db($this->database, $this->dbConn); + + if($this->databaseExists($this->database)) { + mssql_select_db($this->database, $this->dbConn); + } + $this->tableList = $this->fieldList = $this->indexList = null; } /** * Returns true if the named database exists. + * @return boolean */ public function databaseExists($name) { - $SQL_name = Convert::raw2sql($name); - $listDBs = $this->query('SELECT NAME FROM sys.sysdatabases'); - foreach($listDBs as $listedDB) { - if($listedDB['NAME'] == $name) return true; + if($listDBs) { + foreach($listDBs as $listedDB) { + if($listedDB['NAME'] == $name) return true; + } } - return false; }