Xojo SelectSQL clarification

In the Xojo docs for SelectSQL it states

If the SQL does not return data then Nil is returned. Nil is also usually returned if there is an error in the SQL statement, but you should instead catch the DatabaseException to check if an error occurred.

The first sentence is incorrect. If the query is valid but doesn’t return any rows, then the result is an empty RowSet, not a Nil one.

But my question is, is there any situation where the RowSet could be Nil without a DatabaseException being raised? I see a lot of code posted where they’re checking for Nil while also catching for DatabaseException, and I have been too, for the most part. But is this really necessary? I think not, and it’s just a carryover habit from API 1 (SQLSelect with RecordSet). In fact, that incorrect sentence is identical to the one for SQLSelect.

Just trying to reduce/simplify my code.

I cannot think of a situation where the result would be nil, except for a malformed query.

A proper query will as you stated return an EMPTY recordset, not a NIL one

API 1 habit most likely.

-Karen

Not only malformed, but also if any structure that’s used in the query has changed that would make the query not execute. But any of this raises an exception, so checking for Nil is moot. Not a great error handling method, but it can be made to work.