Fixed error where rowCount() (PDO) is used for SELECT statements.

As per our earlier discussion. SQL engines like SQLite (and others) will not correctly return rowCount() for queries that do not modify the database. The rowCount() strategy in ```check_sql``` and ```getRow``` has been replaced and augmented so that this code works correctly with these engines.