Simplified processing loop for caching results.
Fixed a defect with the handling of RecordCount(): When the SQL query was
not a SELECT, SHOW, DESCRIBE or EXPLAIN query this causing an error instead
of correctly returning 0.