MINOR Code formatting fixes

This commit is contained in:
Sean Harvey 2009-04-28 05:33:26 +00:00
parent 874f28aa71
commit 0d1b808700

View File

@ -210,21 +210,25 @@ class MSSQLDatabase extends Database {
*/ */
public function selectDatabase($dbname) { public function selectDatabase($dbname) {
$this->database = $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; $this->tableList = $this->fieldList = $this->indexList = null;
} }
/** /**
* Returns true if the named database exists. * Returns true if the named database exists.
* @return boolean
*/ */
public function databaseExists($name) { public function databaseExists($name) {
$SQL_name = Convert::raw2sql($name);
$listDBs = $this->query('SELECT NAME FROM sys.sysdatabases'); $listDBs = $this->query('SELECT NAME FROM sys.sysdatabases');
foreach($listDBs as $listedDB) { if($listDBs) {
if($listedDB['NAME'] == $name) return true; foreach($listDBs as $listedDB) {
if($listedDB['NAME'] == $name) return true;
}
} }
return false; return false;
} }