Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Illuminate/Database/Connectors/SqlServerConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ protected function getDsn(array $config)
// First we will create the basic DSN setup as well as the port if it is in
// in the configuration options. This will give us the basic DSN we will
// need to establish the PDO connections and return them back for use.
$port = isset($config['port']) ? ','.$port : '';

if (in_array('dblib', $this->getAvailableDrivers()))
{
$port = isset($config['port']) ? ':'.$port : '';

return "dblib:host={$host}{$port};dbname={$database}";
}

$port = isset($config['port']) ? ','.$port : '';

$dbName = $database != '' ? ";Database={$database}" : '';

return "sqlsrv:Server={$host}{$port}{$dbName}";
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ protected function getDsn(array $config)
{
extract($config);

$port = isset($config['port']) ? ','.$port : '';

if (in_array('dblib', PDO::getAvailableDrivers()))
{
$port = isset($config['port']) ? ':'.$port : '';
return "dblib:host={$host}{$port};dbname={$database}";
}
else
{
$port = isset($config['port']) ? ','.$port : '';
return "sqlsrv:Server={$host}{$port};Database={$database}";
}
}
Expand Down