Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

$db->finish usage

Quote Reply
$db->finish usage
I noticed that the $db->finish command is not used everywhere to free used resources but only in some cases.
Could some one exmplain why and when it has to be used?

Thanks in advance



lepo
Quote Reply
Re: $db->finish usage In reply to
The short answer:

For MySQL you don't have to worry about it. It's used for portability with other databases.

It recycles a statement handle when you are done with it, to free resources. MySQL does this automatically.
Quote Reply
Re: $db->finish usage In reply to
Do you mean $sth->finish or $dbh->disconnect? If you mean ->finish, this is normally auto-magically called whenever the statement handle is destroyed and is not normally neccessary. So as long as your variables are scoped locally, it isn't an issue.

As for dbh->disconnect, this gets called once whenever the program is brought down, it's in the END {} block in DBSQL.pm.

Cheers,

Alex
Quote Reply
Re: $db->finish usage In reply to
And, with $dbh->disconnect if you _don't_ call it, and you were _not_ using DBSQL.pm, you need to manually call it at the end of your program, or it will start littering your error.log every time the program runs with a worthless "program ended with no explicit disconnect." type of message.