Re: Freeing Pear DB resources
| From: | Justin Patrin | Date: | Sat, 29 Apr 2006 20:58:50 +0000 |
| Subject: | Re: Freeing Pear DB resources | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23893@lists.php.net to get a copy of this message | ||
On 4/29/06, Stanford S. Guillory <sguillory@vzavenue.net> wrote:
Hello,The resources are always cleaned up on script end. -- Justin PatrinI 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 functionswhich 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?