Commit da64aff6 authored by Andreas Pohl's avatar Andreas Pohl Committed by Steve Müller

Revert "build a correct connection string for mirrored databases, too. In this...

Revert "build a correct connection string for mirrored databases, too. In this case "host=ip1:port,ip2:port" servername and dbname are optional but can also be used without host parameter"

This reverts commit 0698cba6.
parent eff9d44a
......@@ -45,7 +45,6 @@ class Driver extends AbstractSQLAnywhereDriver
isset($params['port']) ? $params['port'] : null,
isset($params['server']) ? $params['server'] : null,
isset($params['dbname']) ? $params['dbname'] : null,
isset($params['charset']) ? $params['charset'] : null,
$username,
$password,
$driverOptions
......@@ -74,40 +73,27 @@ class Driver extends AbstractSQLAnywhereDriver
* SQL Anywhere allows multiple database server instances on the same host,
* therefore specifying the server instance name to use is mandatory.
* @param string $dbname Name of the database on the server instance to connect to.
* @param string $charset Charset
* @param string $username User name to use for connection authentication.
* @param string $password Password to use for connection authentication.
* @param array $driverOptions Additional parameters to use for the connection.
*
* @return string
*/
private function buildDsn($host, $port, $server, $dbname, $charset, $username = null, $password = null, array $driverOptions = array())
private function buildDsn($host, $port, $server, $dbname, $username = null, $password = null, array $driverOptions = array())
{
// $host = $host ?: 'localhost';
// $port = $port ?: 2638;
$host = $host ?: 'localhost';
$port = $port ?: 2638;
if (!empty($host)) {
$host = 'HOST=' . $host . (isset($port) ? (':' . $port) : '');
}
if (!empty($server)) {
$server = 'ServerName=' . $server;
}
if (!empty($dbname)) {
$dbname = 'DBN=' . $dbname;
}
if (!empty($charset)) {
$charset = 'CS=' . $charset;
if (! empty($server)) {
$server = ';ServerName=' . $server;
}
return
$host .
';'. $server .
';'. $dbname .
'HOST=' . $host . ':' . $port .
$server .
';DBN=' . $dbname .
';UID=' . $username .
';PWD=' . $password .
';' . $charset .
';' . implode(
';',
array_map(function ($key, $value) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment