For select statements you can always do this, although it's lots of extra overhead:
SELECT count(*) as countof FROM ... WHERE etc.
This query will always return a result that contains your number of rows to be returned in the next query, even if that number is zero.
Of course you have to author these queries for every SELECT statement which few people want to do, but it's an alternative to doing the query and relying on the client result set feature that provides num_rows, or using Mac's idea. In cases of large datasets that need to be paginated, Mac's work around would be bad.