版主请进,PFC高手请进,讨论pfc_save()保存事件的处理过程
pfc_save()事件的处理过程包括以下代码:
Integer li_rc
Integer li_save_rc
Integer li_endtran_rc
powerobject lpo_updatearray[]
// Check if the CloseQuery process is in progress
If Not ib_closestatus Then
// Determine the objects for which an update will be attempted.
// For the pfc_save, the order sequence is as follows:
// 1) Specified one time sequence (thru pfc_saveobjects event).
// 2) Specified permananent sequence (thru of_SetUpdateObjects(...)).
// 3) None was specified, so use default window control array.
If UpperBound(ipo_tempupdateobjects) > 0 Then
lpo_updatearray = ipo_tempupdateobjects
ElseIf UpperBound(ipo_updateobjects) > 0 Then
lpo_updatearray = ipo_updateobjects
Else
lpo_updatearray = This.Control
End If
// Perform the Update Checks to determine if there are any updates
// pending and if they pass the standard validation
li_rc = of_UpdateChecks(lpo_updatearray)
If li_rc <= 0 Then
// 0 = No pending changes found
// -1 = AcceptText error
// -2 = UpdatesPending error was encountered
// -3 = Validation error was encountered
Return li_rc
End If
End If
// Perform the Update Preparation process.
If This.Event pfc_UpdatePrep(ipo_pendingupdates) <> 1 Then Return -9
// Perform the preupdate process.
If This.Event pfc_PreUpdate() <> 1 Then Return -4
// Begin the transaction.
If This.Event pfc_BeginTran() <> 1 Then Return -5
// Prevent datawindow dberror messages from appearing while PFC_Save
// updates are in progress.
ib_savestatus = True
// Update the changed objects.
li_save_rc = This.Event pfc_Update (ipo_pendingupdates)
// PFC_Save Updates are no longer in progress.
ib_savestatus = False
// Perform the endtransaction process
li_endtran_rc = This.Event pfc_EndTran(li_save_rc)
// If appropriate, display dberror message.
If li_save_rc<=0 Then This.Event pfc_dberror()
// Check for a successful save before performing any post operation.
If li_save_rc <> 1 Then Return -6
// Check for a successful end transaction before performing any post operation.
If li_endtran_rc <> 1 Then Return -7
// Perform the postupdate process.
If This.Event pfc_PostUpdate(ipo_pendingupdates) <> 1 Then Return -8
Return 1
//////////////////////////////////////////////////////////////////////////
我的理解是,pfc会先考察窗口中所有的数据窗口控件是否发生了修改,在pfc_UpdatePrep()事件的处理中,祖先程序会标记这些发生修改的数据窗口保存到
ipo_pendingupdates数组中,当我在pfc_UpdatePrep()事件中写入数据计算代码,然后
把计算的结果setitem()到某个数据窗口中时,pfc_UpdatePrep()事件的祖先程序并不能
把这些改变的数据窗口标记到ipo_pendingupdates中,这样的结果时,这些改变不能提交到数据库,这个问题怎样解决呢????