in reply to SQLite: how to get a number of rows from SELECT query

This is why my favorite DBI method is selectall_arrayref with the attribute Slice set

my $rows= $dbh->selectall_arrayref( "SELECT * FROM table", { Slice = +> {} } );

Sure it looks wonky and pretentious but this approach gives my an array reference of hash references where the hash key is the column name and the values are well, the data values. Now you can just use perl to get the size:

printf "Executed Statement - returned (%d) rows\n", scalar( @$rows ) +;

As a developer the concept of prepare, execute, and fetch is alluring and I can see its' value in certain situations but pragmatically, wrapping those steps into one is the common case with re-use of statement handle being the uncommon case (and for the future comments, I said uncommon - not rare). I am aware of the downsides to this approach such as the result set being too large and needing to be fetched in smaller batch sizes but I find a lot of the downsides to be outlier cases that are rarely hit (at least for my domain).