Struppi: mySQL und Perl

Beitrag lesen

my $sth=$dbh->prepare($st);
$sth->execute();
my $rows=$sth->rows;

Das ist nicht notwendig, execute gibt die Anzahl der Reihen bereits zurück.
http://search.cpan.org/~timb/DBI/DBI.pm#execute

For a non-SELECT statement, execute returns the number of rows affected, if known. If no rows were affected, then execute returns "0E0", which Perl will treat as 0 but will regard as true. Note that it is not an error for no rows to be affected by a statement. If the number of rows affected is not known, then execute returns -1.

Struppi.