On Thu 24 Jan 2002 15:59, Flemming Frandsen <[EMAIL PROTECTED]> wrote:
> Tim Bunce wrote:
> 
> > Sigh.
> > 
> > No one need ever call finish except when they know that they
> > have not fetched all their data.
> 
> Well, I figured as much, but it would seem that several drivers don't
> clean up very well in some of the corner cases like empty result sets
> it's also hard to catch.

defensive programming also makes sense:

{   # Create a new lexical scope
    my $sth = $dbh->prepare ($statement);
    while (my $r = $sth->fetchrow_arrayref) {
        $r->[0] or last; # Some situation where we don't want *all* data
        :
        :
        }
   } # End-of-scope automatically destoy's all handles local to that scope

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.7.1 & 630 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
     WinNT 4, Win2K pro & WinCE 2.11 often with Tk800.022 &/| DBD-Unify
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/H/HM/HMBRAND/

Reply via email to