of_updatespending


pfcapsrv.pbl   >   pfc_n_cst_luw   >   of_updatespending   

Full name pfc_n_cst_luw.of_updatespending
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_updatespending(powerobject[])

Name Datatype
No Data

Name Datatype
la_rc any
lb_defined Boolean
lb_performedtest Boolean
lb_updatespending Boolean
lds_nonpfc DataStore
ldw_nonpfc DataWindow
li_i Integer
li_max Integer
li_newupper Integer
li_rc Integer
lpo_tocheck Powerobject
ls_args string[]
ls_updatetable string
ltab_control tab
luo_control UserObject
lw_control Window

protected function integer of_updatespending (powerobject apo_control[]);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  
//	of_UpdatesPending
//
//	Access:  protected
//
//	Arguments:
//	apo_control array of controls to check for any updates pending
//
//	Returns:  integer
//	 # of objects with updates pending
//	-1 = error
//
//	Description:
//	Check in each object for updatespending for the specified array and store
//	references in ipo_pendingupdates
//
//	Note:
//	This function is called recursively to handle tab controls and UserObjects
//
//////////////////////////////////////////////////////////////////////////////
//	
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_newupper, li_max, li_i, li_rc
Boolean		lb_updatespending=False
Boolean		lb_performedtest=False
any			la_rc
string		ls_updatetable
string		ls_args[]
Boolean		lb_defined
Powerobject	lpo_tocheck
UserObject	luo_control
tab			ltab_control
Window		lw_control
DataWindow 	ldw_nonpfc
DataStore	lds_nonpfc

// If requested use the assist funtionality.
If ib_assist Then 
	of_Assist(is_instancename+'.of_UpdatesPending('+of_GetClassNames(apo_control)+')')
End If

// Loop thru all the objects
li_max = UpperBound (apo_control)
For li_i = 1 to li_max
	lpo_tocheck = apo_control[li_i]
	If IsNull(lpo_tocheck) or Not IsValid(lpo_tocheck) Then Continue
	
	// Initialize
	lb_updatespending =False
	lb_performedtest =False
 
	Choose Case TypeOf ( lpo_tocheck )

		// Windows!, Tabs!, and UserObjects! can either be SelfUpdatingObjects (SUO) or
		// they can be controls which may be holding SelfUpdatingObjects.
		// If they are found to be SUO then they will treated as such, if not their
		// respective control array will be traversed in search of other SUOs.

		Case Window!
			If Not of_IsSelfUpdatingObject (lpo_tocheck) Then					
				// Test for Window Controls (which may contain SelfUpdatingObjects)
				lw_control = lpo_tocheck
				li_rc = This.of_updatespending ( lw_control.control ) 
				If li_rc < 0 Then Return -1
				Continue
			End If
			
		Case Tab!
			If Not of_IsSelfUpdatingObject (lpo_tocheck) Then						
				// Test for tab controls (which contain TabPages which may contain SelfUpdatingObjects)
				ltab_control = lpo_tocheck
				li_rc = This.of_updatespending ( ltab_control.control ) 
				If li_rc < 0 Then Return li_rc
				Continue
			End If

		Case UserObject!
			If Not of_IsSelfUpdatingObject (lpo_tocheck) Then					
				// Test for UserObjects (which may contain SelfUpdatingObjects)
				luo_control = lpo_tocheck
				li_rc = This.of_updatespending ( luo_control.control ) 
				If li_rc < 0 Then Return li_rc
				Continue
			End If

	End Choose 
			
	// -- An object which 'may' be a SUO has been encountered. --

	// Determine if the SUO type is one the service has been asked to process.
	If Len (is_typetoprocess) > 0 Then
		If Pos (is_typetoprocess, of_GetType(lpo_tocheck)) = 0 Then
			// Not a SUO type the service has been asked to process.
			Continue
		End If
	End If		

	// Check/Perform for SelfUpdatingObject Functionality.
	lb_defined = inv_metaclass.of_isFunctionDefined &
		(lpo_tocheck.ClassDefinition, "of_UpdatesPending", ls_args)
	If lb_defined Then
		la_rc = lpo_tocheck.Dynamic of_UpdatesPending ()
		If ClassName(la_rc) = 'integer' or ClassName(la_rc)='long' Then
			// Functionality was found.
			If la_rc < 0 Then Return -1
			If la_rc >= 1 Then
				lb_updatespending = True
				If TypeOf (lpo_tocheck) = DataWindow! Then
					// PFC DataWindow.
					// Note: For linked DataWindows only the root is stored.  All of the
					//	DataWindows are processed but the process is always started with 
					//	the root	datawindow.
					// If pfc_MasterUpdatesPending() is found then of_IsRoot() should be there.
					la_rc = lpo_tocheck.Function Dynamic of_IsRoot()
					If ClassName(la_rc) = 'boolean' Then
						lb_updatespending = la_rc
					Else
						Return -1
					End If
				End If
			End If
			lb_performedtest = True
		End If		
	End If
	
	If lb_performedtest = False Then
		// Handle NonPFC DataWindows/DataStores.
		If TypeOf (lpo_tocheck) = DataWindow! Then
			ldw_nonpfc = lpo_tocheck
			ls_updatetable = ldw_nonpfc.Describe("DataWindow.Table.UpdateTable")
			If ls_updatetable = '?' or ls_updatetable = '' Then
			   lb_updatespending = False
			Else
			   lb_updatespending = (ldw_nonpfc.ModifiedCount() + ldw_nonpfc.DeletedCount() >= 1)
			End If							
		ElseIf TypeOf (lpo_tocheck) = DataStore! Then
			lds_nonpfc = lpo_tocheck
			ls_updatetable = lds_nonpfc.Describe("DataWindow.Table.UpdateTable")
			If ls_updatetable = '?' or ls_updatetable = '' Then
			   lb_updatespending = False
			Else
			   lb_updatespending = (lds_nonpfc.ModifiedCount() + lds_nonpfc.DeletedCount() >= 1)
			End If							
		End If		
	End If

	// If Updates are Pending, add the object to the list.
	If lb_updatespending Then
		// Get the new upperbound for the pending changes.
		li_newupper = UpperBound (ipo_pendingupdates)  + 1
		// Store the control with updates pending.
		ipo_pendingupdates[li_newupper] = lpo_tocheck  // *Add Entry* to instance.
	End If

Next

Return UpperBound (ipo_pendingupdates)
end function

     
Name Owner
pfc_n_cst_luw.of_updatespending pfc_n_cst_luw
pfc_n_cst_luw.of_updatespending pfc_n_cst_luw

     
Name Owner
powerobject.typeof powerobject
datawindow.deletedcount datawindow
datawindow.describe datawindow
datawindow.modifiedcount datawindow
datastore.deletedcount datastore
datastore.describe datastore
datastore.modifiedcount datastore
systemfunctions.classname systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.pos systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_metaclass.of_isfunctiondefined pfc_n_cst_metaclass
pfc_n_cst_luw.of_updatespending pfc_n_cst_luw
pfc_n_cst_luw.of_getclassnames pfc_n_cst_luw
pfc_n_cst_luw.of_assist pfc_n_cst_luw
pfc_n_cst_luw.of_isselfupdatingobject pfc_n_cst_luw
pfc_n_cst_luw.of_gettype pfc_n_cst_luw

     
Full name
No Data

     
Name Scope
No Data