Kbase P51276: How to get the data when having the Temp-table Object Handle
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  26/11/2003 |
|
Status: Unverified
GOAL:
How to get the data contained in the Temp-table when having only the its Object Handle
GOAL:
How to loop through the temp-table having only the handle of it.
FIX:
Use DEFAULT-BUFFER-HANDLE Attribute
Like static temp-tables, every dynamic temp-table is created with at least one buffer. This buffer's object handle is returned by this attribute. DEFAULT-BUFFER-HANDLE cannot be called until the TEMP-TABLE-PREPARE( ) method has been called, since the default buffer is not created until then.
For example you can use a code like this:
/* tth is the handle of the Temp-Table */
/* Now we run a query to access the temp-table */
DEFINE VARIABLE fld AS HANDLE.
DEFINE VARIABLE qh AS HANDLE.
CREATE QUERY qh.
qh:SET-BUFFERS(tth:DEFAULT-BUFFER-HANDLE).
qh:QUERY-PREPARE("for each " + tth:NAME ) .
qh:QUERY-OPEN().
DEFINE VARIABLE i AS INTEGER NO-UNDO.
REPEAT WITH DOWN:
qh:GET-NEXT().
IF qh:QUERY-OFF-END THEN LEAVE.
DO i = 1 TO tth:DEFAULT-BUFFER-HANDLE:NUM-FIELDS WITH DOWN:
fld = tth:DEFAULT-BUFFER-HANDLE:BUFFER-FIELD(i).
DISPLAY fld:BUFFER-VALUE() FORMAT "X(20)" LABEL "My loop".
END.
END.
qh:QUERY-CLOSE().
tth:DEFAULT-BUFFER-HANDLE:BUFFER-RELEASE().
DELETE OBJECT tth.
DELETE OBJECT qh.