in reply to Re: Re: Re: Sqlite DBI $sth->rows
in thread Sqlite DBI $sth->rows

my $sql = { SELECT count(*) FROM patient_data WHERE name = ? }; my $sth = $dbh->prepare($sql); $sth->execute($name); my ($count_rows) = $sth->fetchrow_array();
Note that this is not complete without a finish() call:
$sth->finish();
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.

If you omit it, you'll get a warning from DBI, or you should. (Maybe this depends on the database driver?)