Select to view content in your preferred language

New method: bool IsValidDefinitionQuery(string sql)

120
0
09-12-2024 03:26 AM
Status: Open
Labels (3)
PeterVanSchevensteen
Emerging Contributor

I'd like to have a new method for BasicFeatureLayer and SubtypeGroupLayer: bool IsValidDefinitionQuery(string sql).

If the user is in charge of the content of the definition query, it could have syntax errors or fields that are missing from the layer. So I'd like to validate the sqlbefore I set it as definition query. Currently the workaround is to perform a Search on the layer using the sql as the WhereClause and checking for a GeodatabaseException with HResult == -2146233088. This is ugly and clumsy. Also, in my add-in the user's definition query is to be applied to every layer for which it is valid, and given that there are hundreds of layers, this workaround makes it prohibitively slow.