DBI-related bugfix, add missing prereqs

We shouldn't trust the return value of ->rows, as it can't always work as expected here.

Also, add four missing prereqs.