Hello,
I have a program in which I have a temp-table in which I store some MEMPTR variable, like this (simplified code) :
My question is : how to do the clean up properly ? (considering that I have BLOB field which points to MEMPTR) ?
Not sure that EMPTY TEMP-TABLE ttChunk (or DELETE ttChunk.) will actually delete my MEMPTR data variable content.
My approach will be to do :
But do not know if this is required (maybe too much/slow down the perf for nothing) ?
Or maybe doing a simple EMPTY TEMP-TABLE ttChunk. (or FOR EACH ttChunk : DELETE ttChunk. END.) will be enough for that?
Thanks in advance.
Regards,
I have a program in which I have a temp-table in which I store some MEMPTR variable, like this (simplified code) :
Code:
DEFINE TEMP-TABLE tt-Chunk NO-UNDO
FIELD Order AS INTEGER
FIELD Data AS BLOB
FIELD Size AS INT64
INDEX i IS PRIMARY UNIQUE fi-Order.
DEFINE VARIABLE mData AS MEMPTR NO-UNDO.
/*set the MEMPTR with some data*/
/*start a loop that will create many records, like this : */
CREATE ttChunk.
ASSIGN
ttChunk.Order = iChunkNum
ttChunk.Data = mData
.
/*end of the loop*/
/* I do some processing with ttChunk, and after I need to do some clean up.*/
My question is : how to do the clean up properly ? (considering that I have BLOB field which points to MEMPTR) ?
Not sure that EMPTY TEMP-TABLE ttChunk (or DELETE ttChunk.) will actually delete my MEMPTR data variable content.
My approach will be to do :
Code:
DEFINE VARIABLE mChunkData AS MEMPTR NO-UNDO.
FOR EACH ttChunk EXCLUSIVE-LOCK
:
COPY-LOB FROM OBJECT ttChunk.Data TO OBJECT mChunkData NO-CONVERT. /*retrieve the memptr data*/
SET-SIZE(mChunkData) = 0. /*delete the memptr data*/
IF GET-SIZE(mChunkData) = 0 /*control if the data has actually been deleted*/
DELETE ttChunk.
END.
But do not know if this is required (maybe too much/slow down the perf for nothing) ?
Or maybe doing a simple EMPTY TEMP-TABLE ttChunk. (or FOR EACH ttChunk : DELETE ttChunk. END.) will be enough for that?
Thanks in advance.
Regards,
Last edited: