Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge 973e736 into 23276c6
Browse files Browse the repository at this point in the history
  • Loading branch information
JargonMan committed Aug 8, 2018
2 parents 23276c6 + 973e736 commit e811f1e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/Adapter/Driver/IbmDb2/Connection.php
Expand Up @@ -149,7 +149,28 @@ public function isConnected()
public function disconnect()
{
if ($this->resource) {
db2_close($this->resource);

// localize
$p = $this->connectionParameters;

// given a list of key names, test for existence in $p
$findParameterValue = function (array $names) use ($p) {
foreach ($names as $name) {
if (isset($p[$name])) {
return $p[$name];
}
}

return;
};
$isPersistent = $findParameterValue(['persistent', 'PERSISTENT', 'Persistent']);

if ((bool) $isPersistent) {
db2_pclose($this->resource);
} else {
db2_close($this->resource);
}

$this->resource = null;
}

Expand Down

0 comments on commit e811f1e

Please sign in to comment.