For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > April 2006 > Re: [PEAR] Freeing Pear DB resources









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Freeing Pear DB resources
Justin Patrin

2006-04-29, 6:59 pm

On 4/29/06, Stanford S. Guillory <sguillory@vzavenue.net> wrote:
> Hello,
>
> I had some questions about freeing Pear DB resources and connections.
>
>
>
> 1) Although there is a disconnect() method to free the DB connectio=

n,
> it appears in monitoring my MySQL instance that connections are freed
> automatically after the web server has executed the script and returned t=

he
> 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 t=

he
> presence of error checking with no concept of a "finally" block could pro=

ve
> 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 i=

n a
> few instances. Do I need to manually call DB_Resullt::free() myself in th=

is
> instances, or will Pear/PHP clean those up also when the script execution
> ends?
>


The resources are always cleaned up on script end.

--
Justin Patrin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com