mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
MINOR Tidy up of code in MSSQLDatabase::__construct()
This commit is contained in:
parent
75b1933ca3
commit
083517d02b
@ -134,26 +134,20 @@ class MSSQLDatabase extends SS_Database {
|
||||
ini_set('sqlsrv.WarningsReturnAsErrors', 'Off');
|
||||
}
|
||||
|
||||
// Windows authentication doesn't require a username and password
|
||||
if(defined('MSSQL_USE_WINDOWS_AUTHENTICATION') && MSSQL_USE_WINDOWS_AUTHENTICATION == true) {
|
||||
$connectionInfo = array(
|
||||
'CharacterSet' => 'UTF-8',
|
||||
'MultipleActiveResultSets' => true
|
||||
);
|
||||
} else {
|
||||
$connectionInfo = array(
|
||||
'UID' => $parameters['username'],
|
||||
'PWD' => $parameters['password'],
|
||||
'CharacterSet' => 'UTF-8',
|
||||
'MultipleActiveResultSets' => true
|
||||
);
|
||||
$options = array(
|
||||
'CharacterSet' => 'UTF-8',
|
||||
'MultipleActiveResultSets' => true
|
||||
);
|
||||
if(!(defined('MSSQL_USE_WINDOWS_AUTHENTICATION') && MSSQL_USE_WINDOWS_AUTHENTICATION == true)) {
|
||||
$options['UID'] = $parameters['username'];
|
||||
$options['PWD'] = $parameters['password'];
|
||||
}
|
||||
$this->dbConn = sqlsrv_connect($parameters['server'], $connectionInfo);
|
||||
|
||||
$this->dbConn = sqlsrv_connect($parameters['server'], $options);
|
||||
}
|
||||
|
||||
if(!$this->dbConn) {
|
||||
$this->databaseError("Couldn't connect to MS SQL database");
|
||||
|
||||
$this->databaseError('Couldn\'t connect to SQL Server database');
|
||||
} else {
|
||||
$this->database = $parameters['database'];
|
||||
$this->selectDatabase($this->database);
|
||||
|
Loading…
Reference in New Issue
Block a user