of_registerdatasource


pfcapsrv.pbl   >   pfc_n_cst_tvsrv_levelsource   >   of_registerdatasource   

Full name pfc_n_cst_tvsrv_levelsource.of_registerdatasource
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_registerdatasource(integer,string,string,n_tr,string,powerobject[],datawindow,datastore,string)

Name Datatype
No Data

Name Datatype
li_rc Integer
ls_cacheid string

protected function integer of_registerdatasource (integer ai_level, string as_method, string as_dataobject, n_tr atr_obj, string as_sql, powerobject apo_data[], datawindow adw_control, datastore ads_control, string as_importfile);//////////////////////////////////////////////////////////////////////////////
//
//	Function:	of_RegisterDataSource
//
//	Access:		protected
//
//	Arguments:  
//	ai_Level				The TreeView level to associate the data source with.
//	as_method			The Method we will use to populate the data source
//	as_dataobject		The DataWindow object to be used for the data source.
//	atr_obj				The transaction object for this data source (can be
//								different for each level).
//	as_sql				The SQL Statement to be used for the data source (if specified).
//	apo_data[]			The data to be used for the data source (if specified).
//	adw_control			The datawindow control to be used for the data source (if specified).
//	ads_control			The datastore control to be used for the data source (if specified).
//	as_importfile		The import file from which to be used for the data source (if specified).
//
//	Returns:  Integer
//	 1 if it succeeds
//	-1 if an error occurs.
//	
//	Description:
//	Register the datasource definition with the cache service.
//
//////////////////////////////////////////////////////////////////////////////
//	
//	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_rc
string	ls_cacheid

// create the cache id
ls_cacheid = CACHE_ID + string(ai_level)

CHOOSE CASE as_method
	CASE inv_cache.DATASTORECONTROL
		// register a datastore control
		If IsValid(ads_control) Then
			If inv_cache.of_IsRegistered(ls_cacheid) > 0 Then
				// already registered so unregister and re-register
				li_rc = inv_cache.of_unregister(ls_cacheid)
			End If				
			li_rc = inv_cache.of_register(ls_cacheid, ads_control, TRUE)
		Else
			li_rc = -1
		End If
		Return li_rc
	CASE inv_cache.DATAWINDOWCONTROL
		// register a datawindow control
		If IsValid(adw_control) Then
			If inv_cache.of_IsRegistered(ls_cacheid) > 0 Then
				// already registered so unregister and re-register
				li_rc = inv_cache.of_unregister(ls_cacheid)
			End If				
			li_rc = inv_cache.of_register(ls_cacheid, adw_control, TRUE)
		Else
			li_rc = -1
		End If
		Return li_rc
	CASE inv_cache.POWEROBJECT
		// register a powerobject 
		If (UpperBound(apo_data) <> 0) and Not IsNull(apo_data) Then
			If inv_cache.of_IsRegistered(ls_cacheid) > 0 Then
				// already registered so unregister and re-register
				li_rc = inv_cache.of_unregister(ls_cacheid)
			End If				
			li_rc = inv_cache.of_register(ls_cacheid, as_dataobject, apo_data)
		Else
			li_rc = -1
		End If
		Return li_rc
	CASE inv_cache.IMPORTFILE
		// register a file from disk
		If Len(as_importfile) <> 0 and Not IsNull(as_importfile) Then
			If inv_cache.of_IsRegistered(ls_cacheid) > 0 Then
				// already registered so unregister and re-register
				li_rc = inv_cache.of_unregister(ls_cacheid)
			End If				
			li_rc = inv_cache.of_register(ls_cacheid, as_dataobject, as_importfile, TRUE)
		Else
			li_rc = -1
		End If
		Return li_rc
	CASE inv_cache.RETRIEVE
		// register a Retrieve
		If Len(as_dataobject) <> 0 and Not IsNull(as_dataobject) and &
			IsValid(atr_obj) and Not IsNull(atr_obj) Then
				If inv_cache.of_IsRegistered(ls_cacheid) > 0 Then
					// already registered so unregister and re-register
					li_rc = inv_cache.of_unregister(ls_cacheid)
				End If				
				li_rc = inv_cache.of_register(ls_cacheid, as_dataobject, atr_obj, FALSE)
		Else
			li_rc = -1
		End If
		Return li_rc
	CASE inv_cache.SQL
		// register a SQL statement
		If Len(as_sql) <> 0 and Not IsNull(as_sql) and &
			IsValid(atr_obj) and Not IsNull(atr_obj) Then
				If inv_cache.of_IsRegistered(ls_cacheid) > 0 Then
					// already registered so unregister and re-register
					li_rc = inv_cache.of_unregister(ls_cacheid)
				End If				
				li_rc = inv_cache.of_register(ls_cacheid, atr_obj, as_sql, FALSE)
		Else
			li_rc = -1
		End If
		Return li_rc
	CASE inv_cache.DATAOBJECTDATA
		// register a dataobject
		If Len(as_dataobject) <> 0 and Not IsNull(as_dataobject) Then
			If inv_cache.of_IsRegistered(ls_cacheid) > 0 Then
				// already registered so unregister and re-register
				li_rc = inv_cache.of_unregister(ls_cacheid)
			End If				
			li_rc = inv_cache.of_register(ls_cacheid, as_dataobject)
		Else
			li_rc = -1
		End If
		Return li_rc
	CASE ELSE
		// didn't register anything
		Return -1
END CHOOSE

// didn't register anything
return -1

end function

     
Name Owner
pfc_n_cst_tvsrv_levelsource.of_register pfc_n_cst_tvsrv_levelsource

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.string systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_dwcache.of_isregistered pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_unregister pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_register pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_register pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_register pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_register pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_register pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_register pfc_n_cst_dwcache
pfc_n_cst_dwcache.of_register pfc_n_cst_dwcache

     
Full name
No Data

     
Name Scope
No Data