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

Conversation

@JargonMan
Copy link

The db2_pconnect allows persistent connections to be made in the connect function, but the db2_close function in the disconnect function does not close those connections. This change allows a boolean to be passed to the disconnect function with a value of true that will allow a persistent connection to be closed.

The db2_pconnect allows persistent connections to be made in the connect function, but the the db2_close function in the disconnect function does not close those connections.  This change allows a boolean to be passed to the disconnect function with a value of true that will allow a persistent connection to be closed.
* {@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']);

@JargonMan JargonMan closed this Aug 8, 2018
@JargonMan JargonMan deleted the patch-1 branch August 8, 2018 20:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants