Consultor Eletrônico



Kbase 16515: Example: Making a potentially slow query interruptible
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
Example: Making a potentially slow query interruptible

This knowledgebase entry has an example of how to make
a query that is interruptible if the query is taking
too long to complete. This is done by creating a
temporary table of the intermediate results, and then
doing an OPEN QUERY on that temporary table.

This program allows the end-user to press control-c to
terminate a query that is taking a long time (for example
on an unindexed field), without stopping the program
completely.

This example was written using Version 8.1A, but could
easily be adapted for earlier versions by not using
BUFFER-COPY.


DEFINE TEMP-TABLE t-customer LIKE customer.
DEFINE QUERY rrr FOR t-customer FIELDS (name cust-num).
DEFINE BROWSE Brrr QUERY rrr DISPLAY name cust-num
WITH 5 DOWN.
DEFINE FRAME F1 Brrr AT ROW 2 COLUMN 2.

DO ON STOP UNDO, LEAVE:
MESSAGE "RUNNING build-temp".
RUN build-temp.
MESSAGE "DONE RUNNING build-temp".
END.

OPEN QUERY rrr FOR EACH T-customer.
ENABLE Brrr WITH FRAME F1.

WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.

PROCEDURE build-temp.

REPEAT ON ENDKEY UNDO, LEAVE
ON STOP UNDO, LEAVE:
FIND NEXT customer.
CREATE T-customer.
BUFFER-COPY customer TO T-customer.
PAUSE 1.
END.

END.


Progress Software Technical Support Note # 16515