of_restoreupdatesettings


pfcdwsrv.pbl   >   pfc_n_cst_dwsrv_multitable   >   of_restoreupdatesettings   

Full name pfc_n_cst_dwsrv_multitable.of_restoreupdatesettings
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_restoreupdatesettings(n_cst_dwsrv_multitableattrib)

Name Datatype
No Data

Name Datatype
lb_found boolean
li_colidx integer
li_keycolidx integer
li_num_cols integer
li_num_keys integer
li_num_updateable integer
li_updcolidx integer
ls_column string
ls_mod_string string

protected function integer of_restoreupdatesettings (n_cst_dwsrv_multitableattrib anv_originalupdate);//////////////////////////////////////////////////////////////////////////////
//
//	Function:		of_RestoreUpdateSettings
//
//	Access: 			Protected
//
//	Arguments: 		
//	anv_originalupdate 	Original Update information.
//
//	Returns:   		Integer
// 				  	 1 = The Update Characteristics were successfully reset.
//						-1 = The Modify for Update Characteristics failed.
//
//	Description:  	To reset the datawindow's Update Characteristics to their
//					  	original values.   Called by of_update().
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//	7.0   Argument datatype changed from os_updcharacteristics to n_cst_dwsrv_multitableattrib type
//	7.0   Argument name changed from astr_originalupdate to anv_originalupdate
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1999 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_num_cols
integer	li_num_updateable
integer	li_num_keys
integer	li_colidx
integer	li_keycolidx
integer	li_updcolidx
string	ls_mod_string=''
string	ls_column
boolean	lb_found

// Check the datawindow reference.
If IsNull(idw_Requestor) Or Not IsValid(idw_Requestor) Then Return -1

// Restore the Update Table.
ls_mod_string = "DataWindow.Table.UpdateTable='" + anv_originalupdate.s_updatetable + "' "

// Restore the Update Where statement.
ls_mod_string = ls_mod_string + &
					 "DataWindow.Table.UpdateWhere=" + String(anv_originalupdate.i_whereoption) + " "

// Restore the Update Key In Place flag.
If anv_originalupdate.b_keyupdateinplace Then
	ls_mod_string = ls_mod_string + "DataWindow.Table.UpdateKeyInPlace=yes "  
Else
	ls_mod_string = ls_mod_string + "DataWindow.Table.UpdateKeyInPlace=no "
End If

//Set the original updateable columns and key columns
li_num_updateable = UpperBound (anv_originalupdate.s_updatecolumns) 
li_num_keys = UpperBound (anv_originalupdate.s_keycolumns) 

// Loop thru all the datawindow columns to Restore the Updateable and Key flags.
li_num_cols = Integer(idw_Requestor.Describe ( "DataWindow.Column.Count" ) )
FOR li_colidx = 1 to li_num_cols
	//Get the column name.
	ls_column = idw_Requestor.Describe ( "#" + String(li_colidx) + ".Name" )
	
	// See if the column was marked as an updateable column.
	lb_found = FALSE	
	FOR li_updcolidx = 1 to li_num_updateable 
		IF anv_originalupdate.s_updatecolumns [li_updcolidx] = ls_column THEN 
			lb_found = TRUE
			Exit
		END IF 
	NEXT
	// Restore the Updateable Flag
	IF lb_found THEN 
		ls_mod_string = ls_mod_string + ls_column + ".Update=Yes "
	Else
		ls_mod_string = ls_mod_string + ls_column + ".Update=No "
	END IF
	
	// See if the column was marked as a key column
	lb_found = FALSE	
	FOR li_keycolidx = 1 to li_num_keys
		IF anv_originalupdate.s_keycolumns [li_keycolidx] = ls_column THEN 
			lb_found = TRUE
			Exit
		END IF 
	NEXT
	// Restore the Key column flag
	IF lb_found THEN 
		ls_mod_string = ls_mod_string + ls_column + ".Key=Yes "
	ELSE 		
		ls_mod_string = ls_mod_string + ls_column + ".Key=No "
	END IF 
NEXT  

// Modify the requesting datawindow with the original
// update characteristics
IF idw_Requestor.Modify ( ls_mod_string ) <> "" THEN Return -1

Return 1
end function

     
Name Owner
pfc_n_cst_dwsrv_multitable.of_update pfc_n_cst_dwsrv_multitable

     
Name Owner
datawindow.describe datawindow
datawindow.modify datawindow
systemfunctions.integer systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.string systemfunctions
systemfunctions.upperbound systemfunctions

     
Full name
No Data

     
Name Scope
No Data