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 ...@@ -45,7 +45,6 @@ class Driver extends AbstractSQLAnywhereDriver
isset($params['port']) ? $params['port'] : null, isset($params['port']) ? $params['port'] : null,
isset($params['server']) ? $params['server'] : null, isset($params['server']) ? $params['server'] : null,
isset($params['dbname']) ? $params['dbname'] : null, isset($params['dbname']) ? $params['dbname'] : null,
isset($params['charset']) ? $params['charset'] : null,
$username, $username,
$password, $password,
$driverOptions $driverOptions
...@@ -74,40 +73,27 @@ class Driver extends AbstractSQLAnywhereDriver ...@@ -74,40 +73,27 @@ class Driver extends AbstractSQLAnywhereDriver
* SQL Anywhere allows multiple database server instances on the same host, * SQL Anywhere allows multiple database server instances on the same host,
* therefore specifying the server instance name to use is mandatory. * 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 $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 $username User name to use for connection authentication.
* @param string $password Password to use for connection authentication. * @param string $password Password to use for connection authentication.
* @param array $driverOptions Additional parameters to use for the connection. * @param array $driverOptions Additional parameters to use for the connection.
* *
* @return string * @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'; $host = $host ?: 'localhost';
// $port = $port ?: 2638; $port = $port ?: 2638;
if (!empty($host)) { if (! empty($server)) {
$host = 'HOST=' . $host . (isset($port) ? (':' . $port) : ''); $server = ';ServerName=' . $server;
}
if (!empty($server)) {
$server = 'ServerName=' . $server;
}
if (!empty($dbname)) {
$dbname = 'DBN=' . $dbname;
}
if (!empty($charset)) {
$charset = 'CS=' . $charset;
} }
return return
$host . 'HOST=' . $host . ':' . $port .
';'. $server . $server .
';'. $dbname . ';DBN=' . $dbname .
';UID=' . $username . ';UID=' . $username .
';PWD=' . $password . ';PWD=' . $password .
';' . $charset .
';' . implode( ';' . implode(
';', ';',
array_map(function ($key, $value) { 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