| icPartialUpdateExceptionList | input | character | Comma separated list with fields that need to be skipped in the test logic for partial update. Fields in the list are specified as t<table>.<field>. |
| oiReturnStatus | output | integer | Return status of the method. |
BLF
/* first, take care about the buffers with tc_status = "D". If their rowid is not in the list of vcForceDeleteRowids,
then they should be marked as tc_status = "" */
/* then, make sure to copy the O buffer value of fields that are in vcNeglectableFields to the S buffer */
create query vhTableQuery in widget-pool "non-persistent".
create query vhSTableQuery in widget-pool "non-persistent".
for each tFcDynrel on error undo, throw:
/* no partial update on translations */
if tFcDynRel.tcFcTo = "TransString"
then next.
vhTableQuery:set-buffers(tFcDynRel.thFcBuffer).
vhSTableQuery:set-buffers(tFcDynRel.thFcSBuffer).
/* First check for records with tc_status = "D" in the O buffer, which are not in the S buffer:
these are invalid, and need to be set to tc_status = "" */
vhTableQuery:query-prepare("for each t_o" + tFcDynRel.tcFcTo + " where t_o" + tFcDynRel.tcFcTo + ".tc_status = 'D'").
vhTableQuery:Query-open().
REPEAT on error undo, throw:
vhTableQuery:GET-NEXT().
IF vhTableQuery:QUERY-OFF-END THEN LEAVE.
vhSTableQuery:query-prepare("for each t_s" + tFcDynRel.tcFcTo + " where t_s" + tFcDynRel.tcFcTo + ".tc_rowid = '" + tFcDynRel.thFcBuffer::tc_rowid + "'").
vhSTableQuery:Query-open().
vhSTableQuery:GET-FIRST().
if vhSTableQuery:query-off-end
THEN ASSIGN tFcDynRel.thFcBuffer::tc_status = "".
vhSTableQuery:QUERY-CLOSE().
END.
vhTableQuery:QUERY-CLOSE().
/* Now, go through the S buffer to correct the data in it */
vhSTableQuery:query-prepare("for each t_s" + tFcDynRel.tcFcTo).
vhSTableQuery:Query-open().
repeat on error undo, throw: /* read through the S buffer */
vhSTableQuery:get-next().
if vhSTableQuery:query-off-end then leave.
if tFcDynRel.thFcSBuffer::tc_status = "D"
then do :
if not can-do(vcForceDeleteRowids,string(tFcDynRel.thFcSBuffer:rowid))
then assign tFcDynRel.thFcSBuffer::tc_status = "".
end.
else do /* for "C" and "N" statuses */:
if can-do(vcForceDeleteRowids,string(tFcDynRel.thFcSBuffer:rowid))
then assign tFcDynRel.thFcSBuffer::tc_status = "D".
else do:
vhTableQuery:query-prepare("for each t_o" + tFcDynRel.tcFcTo + " where t_o" + tFcDynRel.tcFcTo + ".tc_rowid = '" + tFcDynRel.thFcSBuffer:buffer-field("tc_rowid"):buffer-value + "'").
vhTableQuery:Query-open().
vhTableQuery:get-first().
if vhTableQuery:query-off-end
then do:
<M-1 run SetMessage
(input #T-2'The source buffer to restore the original field values for the partial update correction could not be found':255(998716596)T-2# (icMessage),
input '' (icArguments),
input '' (icFieldName),
input '' (icFieldValue),
input 'S' (icType),
input 1 (iiSeverity),
input '' (icRowid),
input 'BLF-228':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in database>
assign oiReturnStatus = -5.
return.
end.
do viField = tFcDynRel.thFcSBuffer:num-fields to 1 by -1:
assign vhSField = tFcDynRel.thFcSBuffer:buffer-field(viField).
if vhSField:buffer-value = ?
then do:
if can-do (icPartialUpdateExceptionList, tFcDynRel.thFcBuffer:table + "." + vhSField:name)
then next.
assign vhSField:buffer-value = tFcDynRel.thFcBuffer:buffer-field(vhSField:name):buffer-value.
end.
end.
vhTableQuery:Query-open().
end.
end.
end.
vhSTableQuery:query-close().
end.
finally:
if vhSTableQuery <> ? then delete object vhSTableQuery.
if vhTableQuery <> ? then delete object vhTableQuery.
end finally.