in reply to Re: Re: Re: Sqlite DBI $sth->rows
in thread Sqlite DBI $sth->rows
Note that this is not complete without a finish() call:my $sql = { SELECT count(*) FROM patient_data WHERE name = ? }; my $sth = $dbh->prepare($sql); $sth->execute($name); my ($count_rows) = $sth->fetchrow_array();
You need to use finish if you don't repeat calling fetchrow_*, or equivalent, until it returns undef. So you need it in your second example, too.$sth->finish();
If you omit it, you'll get a warning from DBI, or you should. (Maybe this depends on the database driver?)
|
|---|