-noroutineinwhere - Enum:GetValue() should be exempt...

Posted by Lieven De Foor on 29-Jan-2020 13:36

Using -noroutineinwhere is good practice to prevent unwanted side effects from using a method or property in a WHERE clause.

For cases where the method always returns a constant, like Enum:GetValue(), this should be allowed though.

Even better would be if you could write:

FOR EACH Document NO-LOCK

WHERE Document.Status = DocumentStatus:Draft

Where Status is an integer field

All Replies

Posted by Simon L. Prinsloo on 29-Jan-2020 14:38

[mention:04e040a388574bee96c841b1935762a5:e9ed411860ed4f2ba0265705b8793d05]  There is an idea about automatically casting during assignments, and I think that the above ability to do the comparison fits in perfectly with that idea. Maybe you should add it as a comment to the idea. (I.e, the compiler can implicitly add the STRING() or INTEGER() or INT64() around the enum in your example above.)

https://community.progress.com/community_groups/products_enhancements/i/openedge/automatically_cast_enums_in_assignment_to_database_fields_and_vice_versa#

This thread is closed