>From: Vladislav Safronov [mailto:[EMAIL PROTECTED]]
> sub foo {
>       my $dbh = shift;
> 
>       my $sql = ...
> 
>       my $sth = $dbh->prepare($sql);
>       $sth->execute;
>       $sth->finish;
> }
> ===
> Do I always need to call $sth->finish? Wouldn't it be 
> automaticly called when
> sub foo ends (when my variable $sth get destroyed)?

You do *NOT* need to call $sth->finish - never, never, never.
[OK. not quite true: you need to call $sth->finish when you end a
 select statement before reading the last data in the cursor and
 want to reexecute the select statement. So the answer is:
  NEVER!!!]

If you worry about the statement handle still being defined I
would reccomend using  C<undef $sth> instead. That will
certainly release all resources owned by the statement.
$sth->finish is just for very special cases - and this is
not one of them.

--
Henrik Tougaard, [EMAIL PROTECTED]

Reply via email to