of_register


pfcdwsrv.pbl   >   pfc_n_cst_dssrv_multitable   >   of_register   

Full name pfc_n_cst_dssrv_multitable.of_register
Access public
Extend of integer
Return value integer
Prototype public function integer of_register(string,string[])

Name Datatype
No Data

Name Datatype
lb_keyinplace boolean
li_i integer
li_j integer
li_numcols integer
li_whereoption integer
ls_column string
ls_table string
ls_updateablecolumns string[]

public function integer of_register (string as_table, string as_keycolumns[]);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_Register
//
//	Access:    		Public
//
//	Arguments: 
//  as_table: 			A string containing the table to update
//  as_keycolumns[]: A string array containing the key columns to be used for update
//
//	Returns:  		Integer
// 1 if it succeeds 
//	-1 if an error occurs. 
//
//	Description: 	
//	Registers a table and its corresponding update characteristics with the 
//	service.
//
//	Note:
//	Uses dw default options for -
//		Updateable columns are all columns belong to the passed table
//		Where Option: Key and Updateable Columns
//		Key,Update In Place = FALSE, use Delete / then Insert
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version - Replaces obsoleted function of_AddToUpdate(...)
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

string	ls_updateablecolumns []
string	ls_table
string	ls_column
integer	li_numcols
integer	li_i
integer	li_j
boolean	lb_keyinplace=False 	//Default value
integer	li_whereoption=1 		//Default value

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

// Loop around all the columns on the datawindow searching for Update columns.
li_numcols = Integer ( ids_requestor.Describe ( "DataWindow.Column.Count" ) ) 
FOR li_i = 1 to li_numcols
	ls_column = ids_requestor.Describe ( "#" + String(li_i) + ".Name" )
	IF ls_column = '!' Then Return -1

	// Get the table name for this column
	ls_table  = ids_requestor.Describe (ls_column + ".dbName" ) 
	// Extract just the table portion of the column's database name
	ls_table  = Left ( ls_table, Pos ( ls_table, ".", 1) - 1 )

	// If a column belongs to the passed table, then set it as
 	//	an updateable column 
	IF Lower(as_table) = Lower(ls_table) THEN 
		li_j++
		ls_updateablecolumns[li_j] = ls_column
	END IF
NEXT

Return of_Register(as_table, as_keycolumns, ls_updateablecolumns, &
				lb_keyinplace, li_whereoption) 

end function

     
Name Owner
No Data

     
Name Owner
datastore.describe datastore
systemfunctions.integer systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.left systemfunctions
systemfunctions.lower systemfunctions
systemfunctions.pos systemfunctions
systemfunctions.string systemfunctions
pfc_n_cst_dssrv_multitable.of_register pfc_n_cst_dssrv_multitable

     
Full name
No Data

     
Name Scope
No Data