Freeing Pear DB resources
| From: | Stanford S. Guillory | Date: | Sat, 29 Apr 2006 18:38:48 +0000 |
| Subject: | Freeing Pear DB resources | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-23891@lists.php.net to get a copy of this message | ||
Hello,
I had some questions about freeing Pear DB resources and connections.
1) Although there is a disconnect() method to free the DB connection,
it appears in monitoring my MySQL instance that connections are freed
automatically after the web server has executed the script and returned the
result. So my application has a basic pattern of create a connection, do
something with the database, and forward to the result view, can I just
leave it up to PHP to release the connections? Manually freeing them in the
presence of error checking with no concept of a "finally" block could prove
tedious and error-prone.
2) Most of my queries are done through the get* family of functions
which free result resources for you. I do use the query method directly in a
few instances. Do I need to manually call DB_Resullt::free() myself in this
instances, or will Pear/PHP clean those up also when the script execution
ends?
Thanks,
Stanford S. Guillory