SqliteTableModel: Support EXPLAIN and PRAGMA queries again

Change the approach to count the total number of rows returned by an SQL
query to also support EXPLAIN and PRAGMA statements. These failed before
because you are not allowed to put them into a COUNT query. This commit
adds the code needed to count the number of rows manually when one of
these queries is executed.