project BLF > class Persistence (Progress) > method ReadData

Description

General procedure to read data from the database into the class dataset.
The data is stored into the temp-tables referred by a handle in tFcDynRel.


Parameters


tDynRelinputtemp-tableDescription of the data to read.
ihClassinputhandleHandle to the class that is using the persistence layer. In most of the cases, this handle will be available in the preprocessor {&TARGETPROCEDURE}.
oiReturnStatusoutputinteger


Internal usage


unused


program code (program1/progress.p)

vlEof = ?.

vlEmpty = yes.
for each tDynRel on error undo, throw:
    assign vhTable = tDynRel.thFcBuffer:table-handle.
    if vhTable:has-records
    then vlEmpty = no.
    assign vhTable = tDynRel.thFcIBuffer:table-handle.
    if vhTable:has-records
    then vlEmpty = no.
end.

for each tDynRel where
         tDynRel.tcFcFrom = "" on error undo, throw:
         
    <M-1 run ReadDataRecursive (input  tDynRel.tcFcTo (icTableName), 
                            input  tDynRel.thFcBuffer (ihDestinationBuffer), 
                            input  tDynRel.thFcIBuffer (ihIDestinationBuffer), 
                            input  tDynRel.tcFcRel (icPrepare), 
                            input  '' (icParentRowid), 
                            input  true (ilTopLevel), 
                            input  ihClass (ihClass), 
                            input  vlEmpty (ilStartEmpty), 
                            output oiReturnStatus (oiReturnStatus)) in Progress>
    if oiReturnStatus = -4
    then assign vlEof = (if vlEof = no then no else yes)
                oiReturnStatus = 0.
    else assign vlEof = no.

    empty temp-table tRowidList.
    
    if oiReturnStatus <> 0 then return.
end.

if vlEof
then assign oiReturnStatus = -4.
else if can-find (first tDynRel where tDynRel.tcParent <> "")
then do:
    <M-2 run UpdateParent (output oiReturnStatus (oiReturnStatus)) in Progress>
end.