On Tue, Aug 15, 2000 at 03:26:03PM +0400, Vladislav Safronov wrote:
> Hi,
> 
> Could you have a look at the lines and answer the question ..
> ---
> sub foo {
>       my $dbh = shift;
> 
>       my $sql = ...
> 
>       my $sth = $dbh->prepare($sql);
>       $sth->execute;
>       $sth->finish;
> }
> ===
> Do I always need to call $sth->finish?

You *never* need to call finish on non-select statements.
(If you do, it's a driver bug.)

> Wouldn't it be automaticly called when
> sub foo ends (when my variable $sth get destroyed)?

Finish marks the end of *fetching*, not the end of life of the handle.

Reread the DBI 1.14 docs on finish and tell me if anything is unclear.

Tim.

p.s. If someone asked me what I'd change about the DBI I was to rewrite
it, I'd probably just say "rename finish to cancel_select".

Reply via email to