|
pfc_save
|
|
Full name
|
pfc_w_master.pfc_save
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
event integer pfc_save()
|
Name
|
Datatype
|
li_endtran_rc
|
Integer
|
li_rc
|
Integer
|
li_save_rc
|
Integer
|
lpo_updatearray
|
powerobject[]
|
event pfc_save;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_save
//
// Arguments: none
//
// Returns: integer
// 1 = success
// 0 = No pending changes found
// -1 = AcceptText error
// -2 = UpdatesPending error was encountered
// -3 = Validation error was encountered
// -9 = The pfc_updateprep process failed
// -4 = The pfc_preupdate process failed
// -5 = The pfc_begintran process failed
// -6 = The pfc_update process failed
// -7 = The pfc_endtran process failed
// -8 = The pfc_postsave process failed
//
// Description:
// Performs a save operation on the window.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 5.0.02 Prevent datawindow dberror messages from appearing while the window
// PFC_Save is in progress.
// 6.0 Enhanced to allow updates of specific objects.
// 6.0 Enhanced for pfc_updateprep process.
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
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
end event