Kbase 21582: How to use SESSION System Handle's FIRST-BUFFER attribute
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/22/2008 |
|
Status: Verified
GOAL:
How To Use SESSION System Handle's FIRST-BUFFER Attribute
FACT(s) (Environment):
Progress 9.x
FIX:
The SESSION System Handle's FIRST-BUFFER Attribute returns the buffer handle of the first table that has a dynamic buffer object associated with it. The table may be either a temp-table or an actual database table, in that order. If you do not explicitly create a dynamic buffer through the CREATE BUFFER statement, you will not get a Session buffers chain and, therefore, the FIRST-BUFFER Attribute will return the unknown value (?) when executed.
The purpose of the SESSION System Handle's FIRST-BUFFER Attribute is to aid in finding memory leaks due to a failure to DELETE OBJECT buffer-handle. Static buffers simply go out of scope and never need to be deleted, therefore, they are not on the Session buffers chain.
These programs execute against the sports or sports2000 databases and provide a demonstration of how the Progress Session buffers chain is created.
/*** crDynBuf.i ***/
DEFINE VARIABLE {1} AS HANDLE NO-UNDO.
CREATE BUFFER {1} FOR TABLE {2}.
/*** sesBufChain.p ***/
DEFINE VARIABLE vhCurBufHdl AS HANDLE NO-UNDO.
DEFINE VARIABLE viCounter AS INTEGER NO-UNDO INITIAL 1.
{crDynBuf.i vhCustBufHdl '"customer"':U}
{crDynBuf.i vhInvBufHdl '"invoice"':U}
{crDynBuf.i vhOrdBufHdl '"order"':U}
ASSIGN vhCurBufHdl = SESSION:FIRST-BUFFER.
DO WHILE VALID-HANDLE(vhCurBufHdl):
MESSAGE "Session buffer":U viCounter "=":U vhCurBufHdl:NAME VIEW-AS ALERT-BOX.
ASSIGN vhCurBufHdl = vhCurBufHdl:NEXT-SIBLING
viCounter = viCounter + 1.
END.