mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
MINOR Code formatting fixes
This commit is contained in:
parent
874f28aa71
commit
0d1b808700
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user