Progress
Programming
Handbook


Using a Query Object

Using a dynamic query requires using several methods in addition to the CREATE QUERY statement. The CREATE QUERY statement does not define what database table or buffer you wish to access or what subset of records you want to fetch. The SET–BUFFERS( ) method and the QUERY–PREPARE( ) method specify this information and the QUERY–OPEN( ) method opens the query.

The following code fragment depicts one way of creating and using a dynamic query:

DEFINE VARIABLE qh8 AS WIDGET-HANDLE.

CREATE QUERY qh8. 
qh8:SET-BUFFERS(BUFFER invoice:HANDLE).
qh8:QUERY-PREPARE("FOR EACH invoice BY invoice-date").
qh8:QUERY-OPEN().

REPEAT WITH FRAME fr1:
    qh8:GET-NEXT.
    IF qh8:QUERY-OFF-END THEN LEAVE.
    . . .
END.
.
.
.
DELETE OBJECT qh8. 

For a list of the attributes and methods of the query object, see the Query Object Handle reference entry in the Progress Language Reference . For a complete description of the attributes and methods, see the “Attributes and Methods Reference” chapter of the same book.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095