Skip to content

Commit

Permalink
Refactored IbmDb2\Connection to not use array, also not use dynamic f…
Browse files Browse the repository at this point in the history
…unc. call
  • Loading branch information
ralphschindler committed Nov 21, 2013
1 parent 31b59fc commit 51ee47f
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions library/Zend/Db/Adapter/Driver/IbmDb2/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,17 @@ public function connect()
return null;
};

$connection = array();
$connection['database'] = $findParameterValue(array('database', 'db'));
$connection['username'] = $findParameterValue(array('username', 'uid', 'UID'));
$connection['password'] = $findParameterValue(array('password', 'pwd', 'PWD'));
$connection['persistent'] = $findParameterValue(array('persistent', 'PERSISTENT', 'Persistent'));
$connection['options'] = (isset($p['driver_options']) ? $p['driver_options'] : array());

$db2_connect = ($connection['persistent'] ? 'db2_pconnect' : 'db2_connect');

$this->resource = $db2_connect(
$connection['database'],
$connection['username'],
$connection['password'],
$connection['options']
);
$database = $findParameterValue(array('database', 'db'));
$username = $findParameterValue(array('username', 'uid', 'UID'));
$password = $findParameterValue(array('password', 'pwd', 'PWD'));
$isPersistent = $findParameterValue(array('persistent', 'PERSISTENT', 'Persistent'));
$options = (isset($p['driver_options']) ? $p['driver_options'] : array());

if ($isPersistent) {
$this->resource = db2_pconnect($database, $username, $password, $options);
} else {
$this->resource = db2_connect($database, $username, $password, $options);
}

if ($this->resource === false) {
throw new Exception\RuntimeException(sprintf(
Expand Down

0 comments on commit 51ee47f

Please sign in to comment.