Commit 72fd8661 authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DBAL-201] Fixed IBM DB2 Driver not allowing default values for protocol and port values.

parent a5fe5687
...@@ -41,8 +41,8 @@ class DB2Driver implements Driver ...@@ -41,8 +41,8 @@ class DB2Driver implements Driver
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
if ( !isset($params['schema']) ) { if ( ! isset($params['protocol'])) {
$params['protocol'] = 'TCPIP';
} }
if ($params['host'] !== 'localhost' && $params['host'] != '127.0.0.1') { if ($params['host'] !== 'localhost' && $params['host'] != '127.0.0.1') {
...@@ -50,10 +50,13 @@ class DB2Driver implements Driver ...@@ -50,10 +50,13 @@ class DB2Driver implements Driver
$params['dbname'] = 'DRIVER={IBM DB2 ODBC DRIVER}' . $params['dbname'] = 'DRIVER={IBM DB2 ODBC DRIVER}' .
';DATABASE=' . $params['dbname'] . ';DATABASE=' . $params['dbname'] .
';HOSTNAME=' . $params['host'] . ';HOSTNAME=' . $params['host'] .
';PORT=' . $params['port'] .
';PROTOCOL=' . $params['protocol'] . ';PROTOCOL=' . $params['protocol'] .
';UID=' . $username . ';UID=' . $username .
';PWD=' . $password .';'; ';PWD=' . $password .';';
if (isset($params['port'])) {
$params['dbname'] .= 'PORT=' . $params['port'];
}
$username = null; $username = null;
$password = null; $password = null;
} }
......
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