Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Adapter/Driver/IbmDb2/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ public function isConnected()
/**
* {@inheritDoc}
*/
public function disconnect()
public function disconnect($isPersistent = false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates the interface. See:

/**
* Disconnect
*
* @return ConnectionInterface
*/
public function disconnect();

Copy link
Author

@JargonMan JargonMan Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

Could we implement something like this from the connect function; it seems like overkill and I wasn't sure if the connectionParameters were reliable to make the determination on the db2_close vs db2_pclose.

if (is_resource($this->resource)) {
        return $this;
    }
    // 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 ($this->resource) {
db2_close($this->resource);
if ($isPersistent = false) {
db2_close($this->resource);
} else {
db2_pclose($this->resource);
}
$this->resource = null;
}

Expand Down