Help for this page

Select Code to Download


  1. or download this
    my $sth = $dbh->prepare ("select * from foo");
    $sth->execute;
    ...
        print $ref->[0], "\n";
        }
    # No need for $sth->finish;
    
  2. or download this
    {   my $sth = $dbh->prepare (...);
        $sth->execute;
        ...
        } # End-of-scope: $sth is destroyed
    
  3. or download this
    {   my $stu = $dbh->prepare ("update foo set blah = ? where c_foo = ?"
    +);
        my $sth = $dbh->prepare ("select c_foo, bar from brimble");
    ...
        # no need for $sth->finish
        $stu->finish; # Good practice
        } # End of scope: clean up