Description
Check if any child of a database record has been changed.
Parameters
icTableName | input | character | Database table name. |
ihDestinationBuffer | input | handle | Handle to the class temp-table. |
icParentRowid | input | character | Rowid of the database parent record. |
olFound | output | logical | Changes found |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/persistence.p)
/* ================================================================= */
/* Check if this table has children that where changed */
/* ================================================================= */
if not can-find (first tDynRel where
tDynRel.tcFcFrom = icTableName)
then return.
/* ================================================================= */
/* Check if a record of this tables was changed */
/* ================================================================= */
create query vhTQuery in widget-pool "non-persistent".
vhTQuery:forward-only = yes.
vhTQuery:set-buffers(ihDestinationBuffer).
vhTQuery:query-prepare
("for each ":U + ihDestinationBuffer:name +
" where ":U + ihDestinationBuffer:name +
".tc_ParentRowid = '":U + icParentRowid +
"' and ":U + ihDestinationBuffer:name +
".tc_status <> ''":U +
" and ":U + ihDestinationBuffer:name +
".tc_status <> 'D'":U).
vhTQuery:query-open().
vhTQuery:get-first().
if not vhTQuery:query-off-end
then do:
assign olFound = yes.
vhTQuery:query-close().
delete object vhTQuery.
return.
end.
vhTQuery:query-prepare
("for each ":U + ihDestinationBuffer:name +
" where ":U + ihDestinationBuffer:name +
".tc_ParentRowid = '":U + icParentRowid + "'":U).
vhTQuery:query-open().
vhTQuery:get-first().
do while not vhTQuery:query-off-end:
for each bDynRel where
bDynRel.tcFcFrom = icTableName on error undo, throw:
<M-1 run CheckChanges
(input bDynRel.tcFcTo (icTableName),
input bDynRel.thFcBuffer (ihDestinationBuffer),
input ihDestinationBuffer::tc_Rowid (icParentRowid),
output olFound (olFound),
output viFcReturnSuper (oiReturnStatus)) in persistence>
if olFound
then do:
vhTQuery:query-close().
delete object vhTQuery.
return.
end.
end.
vhTQuery:get-next().
end.
finally:
if vhTQuery <> ?
then do:
vhTQuery:query-close().
delete object vhTQuery.
end.
end finally.