Prepare for SQLite3 support

SQLite3 does not really support $stmt->rows, so we need to check it implicitly.