Jump to content

Closing PEAR database connections


future_man

Recommended Posts

I'm having an issue when closing PEAR DB database connections which either didn't open or possibly having already closed.

 

I have a disconnect() function which looks like this:

 

function disconnect()
{       
    if ($this->database_connection && !DB::isError($this->database_connection)) {
        $this->database_connection->disconnect();           
    }
}

 

It lives in the __destruct() function for a database class which has been extended. 

 

It appears to work as intended most of the time, but one of the classes that extends it seems to be trying to close a connection that either doesn't exist or may have been already closed generating the following error in the log files:

 

[Wed Feb 13 17:50:19 2008] [error] PHPWARN (suppressed; ErrorProcessor) - 192.168.130.136: mysql_close(): 1073 is not a valid MySQL-Link resource in /usr/local/php5/lib/php/DB/mysql.php at line 277

 

I'm trying to find the offending class and code, but is there something else I could be doing to check to make sure its a valid connection before trying to close it?

 

Any help would be much appreciated.

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.