Occasionally i will run into dynamic query errors via web app. I would like to validate the dynamic query prior to running the query.
I know you can do a NO-ERROR on the QUERY-PREPARE. Does anyone have a sample of checking the errors this way. I would rather stop the query from opening if errors are found with the query string.
For example if I have a dynamic query:
I know you can do a NO-ERROR on the QUERY-PREPARE. Does anyone have a sample of checking the errors this way. I would rather stop the query from opening if errors are found with the query string.
For example if I have a dynamic query:
Code:
def var qh-customer as handle no-undo.
create widget-pool "customer".
create query qh-customer in widget-pool "customer".
qh-customer:set-buffers(buffer customer:handle).
qh-customer:query-prepare(ip-query-str) no-error.
/* if errors do not run query and leave .*/
/* how to check the error */
qh-customer:query-open.
if qh-customer:is-open then
do:
repeat:
qh-customer:get-next.
if qh-customer:query-off-end then leave.
display customer.customer-name etc.
end.
end.
qh-customer:query-close().
delete object qh-customer no-error.