[ticket/11305] Add is_object checks to all database drivers.

mysqli driver already does this. Other drivers do not.

If a query is not cached, $query_id is set to the resource
(object) of the result set.

The cache replaces resource with an integer index into its
saved query array.

Therefore is_object check effectively determines whether a query
had been cached without consulting the cache.

PHPBB3-11305