add handler.query_is_empty() method to check if the handler has a query or not