Is it a wanted behavior, that in case that the where condition of FIND-FIRST or FIND-LAST equals to ? is the same like ""?
DEFINE VARIABLE cWhere AS CHARACTER NO-UNDO. cWhere = ?. BUFFER Customer:FIND-FIRST(cWhere, NO-LOCK).
I don't know if it's wanted, but it indeed appears to be the case.
The following are equivalent and do a FIND using the primary index:
- "WHERE TRUE",
I would not allow a developer to rely on that, even if it appears to work.
I'll take the risk of maybe misinterpreting the question.
I think some developers would expext unkown where to throw an error.
It's probably easier to find bugs if where = ? would throw an error.
In our code a lot of find statements are with no-error so throwing an "unknown where clause" error would go undetected .
I've think we could use a "allow-unavailable" option on find to replace the no-error option.
This option would preserve errors such as 7254 (*) without throwing an error when there is no record.
I would expect, that no record is found.
We had a case (find and delete record) where we create a WHERE-Condition dynamically based on the primary unique index of a table, unfortunately, we did not handle the case with ? values in the query string algorithm, which results in WHERE-Condition = ?.
But okay, then I will log an idea request.
"where true" is not ambigous in a FIND-FIRST, only in a FIND-UNIQUE.
I would also like WHERE ? to return no result or even throw an error...
You'll have my vote if you create a feature request for this one ;-)
@lars I voted for the idea.
I also added a slightly related idea asking for an extra option on find to distinguish between records no being available and other errors.
Thank you and you got my vote too.