of_updatebottomupandtopdown


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_linkage   >   of_updatebottomupandtopdown   

Full name pfc_n_cst_dwsrv_linkage.of_updatebottomupandtopdown
Access public
Extend of integer
Return value integer
Prototype public function integer of_updatebottomupandtopdown()

Name Datatype
No Data

Name Datatype
lb_accepttext boolean
lb_delete boolean
lb_insert boolean
lb_resetflag boolean
lb_update boolean
ldw_updatedw u_dw[]
li_i Integer
li_max Integer
ls_sqlspyheading String
ls_sqlspymessage String

public function integer of_updatebottomupandtopdown ();//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_UpdateBottomUpAndTopDown
//
//	Access:    		Public
//
//	Arguments: 		None
//
//	Returns:   		Integer
//   					1 if it succeeds and -1 if an error occurs.
//
//	Description:  Updates the datawindows in the linked chain, starting with
//         		  the bottom-level datawindow and going up the chain (deletes).
//					  The second pass will be top-level datawindow going down the 
//					  chain (inserts and Updates).
//
//	   Note: This function is not typically called by the developer.  
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0    Initial version
// 6.0.01 Corrected 2nd pass sqlspy comment to correctly say (inserts/updates).
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_i
Integer	li_max
boolean	lb_accepttext = False
boolean 	lb_resetflag = False
boolean	lb_insert	
boolean	lb_update
boolean	lb_delete
String	ls_sqlspyheading
String	ls_sqlspymessage
u_dw		ldw_updatedw[]

// Create an array of the linked datawindows for update.
If of_CreateUpdateSequence ( ldw_updatedw ) <> 1 Then Return FAILURE 

// Get the number of datawindows.
li_max = UpperBound ( ldw_updatedw ) 

// -- First loop thru the array; bottom-level datawindow going up the chain.
//    Performing Deletes only.  --
lb_insert = False
lb_update = False
lb_delete = True

//If available notify the SQLSpy service.
If IsValid(gnv_app.inv_debug) Then
	If IsValid(gnv_app.inv_debug.inv_sqlspy) Then

		//Create the heading and message for the SQLSpy.
		ls_sqlspyheading = idw_requestor.ClassName() + '.Linkage'
		ls_sqlspymessage = 'Update dual-pass - 1st pass BottomUp (deletes)'
		
		//Send the information to the service for processing.
		gnv_app.inv_debug.inv_sqlspy.of_sqlSyntax  &
			(ls_sqlspyheading, '/*** ' + ls_sqlspymessage + ' ***/')
	End If
End If

For li_i = li_max to 1 Step -1
	// Update the datawindow.
	If ldw_updatedw[li_i].of_Update &
		(lb_accepttext, lb_resetflag, lb_insert, lb_update, lb_delete) <> 1 Then 
		Return FAILURE
	End If
Next 

// -- Second loop thru the array; top-level datawindow going down the chain.
//    Performing Inserts and Updates only. --
lb_insert = True
lb_update = True
lb_delete = False

//If available notify the SQLSpy service.
If IsValid(gnv_app.inv_debug) Then
	If IsValid(gnv_app.inv_debug.inv_sqlspy) Then

		//Create the heading and message for the SQLSpy.
		ls_sqlspyheading = idw_requestor.ClassName() + '.Linkage'
		ls_sqlspymessage = 'Update dual-pass - 2nd pass ToDown (inserts/updates)'
		
		//Send the information to the service for processing.
		gnv_app.inv_debug.inv_sqlspy.of_sqlSyntax  &
			(ls_sqlspyheading, '/*** ' + ls_sqlspymessage + ' ***/')
	End If
End If

For li_i = 1 to li_max 
	// Update the datawindow.
	If ldw_updatedw[li_i].of_Update &
		(lb_accepttext, lb_resetflag, lb_insert, lb_update, lb_delete) <> 1 Then 
		Return FAILURE
	End If
Next 

Return 1
end function

     
Name Owner
pfc_n_cst_dwsrv_linkage.of_update pfc_n_cst_dwsrv_linkage

     
Name Owner
powerobject.classname powerobject
systemfunctions.isvalid systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_dwsrv_linkage.of_createupdatesequence pfc_n_cst_dwsrv_linkage
pfc_u_dw.of_Update pfc_u_dw
pfc_n_cst_sqlspy.of_sqlsyntax pfc_n_cst_sqlspy

     
Full name
demopfc

     
Name Scope
No Data