project BLF > include bFcRunQuery.i

Description

Query call in business components code.


include parameters


&PARAMETERSParameters needed for the execution of the procedure.
Looks like:
input ip1, input ip2, output tqx
&PROCEDUREThe procedure that has to be executed.
&QUERY-PROCname of the query program
&QUERY-VARhandle variable to run the query procedure persistently


Internal usage


unused


include code

assign viFcQueryReturn = 0.

if hQ{&QUERY-VAR} = ?
then do:
    assign vhFcComponent = dataset tq{&QUERY-VAR}:handle.
    run {&QUERY-PROC} persistent set hQ{&QUERY-VAR}.
    run InitQuery in hQ{&QUERY-VAR}
       (input viSessionId,
        input vlFcStateless,
        input vhFcComponent,
        output viFcIncludeReturn).
    if viFcIncludeReturn < 0
    then do:
        assign oiReturnStatus = viFcIncludeReturn.
        delete procedure hQ{&QUERY-VAR}.
        assign hQ{&QUERY-VAR} = ?.
        return ?.
    end.
end.

run {&PROCEDURE} in hQ{&QUERY-VAR} ({&PARAMETERS}).

if viFcQueryReturn < 0
then do:
    assign oiReturnStatus = viFcQueryReturn.
    return ?.
end.