|
of_RegisterDataSource
|
|
Full name
|
pfc_n_cst_lvsrv_datasource.of_RegisterDataSource
|
Access
|
protected
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
protected function integer of_RegisterDataSource(string,string,n_tr,string,powerobject[],datawindow,datastore,string)
|
Name
|
Datatype
|
li_rc
|
Integer
|
protected function integer of_RegisterDataSource (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);//////////////////////////////////////////////////////////////////////////////
// Protected Function: of_RegisterDataSource
// Arguments: 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 .
// 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 = the data source was added successfully
// -1 = Nothing was registered with the cache
// Description: Register a data source for the ListView with the cache service.
//////////////////////////////////////////////////////////////////////////////
// Rev. History: Version
// 6.0 Initial version
//////////////////////////////////////////////////////////////////////////////
// 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_rc
if IsNull(inv_Cache) or not Isvalid(inv_Cache) then return -1
choose case as_method
case inv_Cache.DATASTORECONTROL
// register a datastore control
if IsValid(ads_control) then
if inv_Cache.of_IsRegistered(CACHE_ID) > 0 then
// already registered so unregister and re-register
li_rc = inv_Cache.of_UnRegister(CACHE_ID)
end if
li_rc = inv_Cache.of_Register(CACHE_ID, ads_control, true)
else
li_rc = -1
end if
case inv_Cache.DATAWINDOWCONTROL
// register a datawindow control
if IsValid(adw_control) then
if inv_Cache.of_IsRegistered(CACHE_ID) > 0 then
// already registered so unregister and re-register
li_rc = inv_Cache.of_UnRegister(CACHE_ID)
end if
li_rc = inv_Cache.of_Register(CACHE_ID, adw_control, true)
else
li_rc = -1
end if
case inv_Cache.POWEROBJECT
// register a powerobject
if (UpperBound(apo_data) <> 0) and not IsNull(apo_data) then
if inv_Cache.of_IsRegistered(CACHE_ID) > 0 then
// already registered so unregister and re-register
li_rc = inv_Cache.of_UnRegister(CACHE_ID)
end if
li_rc = inv_Cache.of_Register(CACHE_ID, as_dataobject, apo_data)
else
li_rc = -1
end if
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(CACHE_ID) > 0 then
// already registered so unregister and re-register
li_rc = inv_Cache.of_UnRegister(CACHE_ID)
end if
li_rc = inv_Cache.of_Register(CACHE_ID, as_dataobject, as_importfile, true)
else
li_rc = -1
end if
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(CACHE_ID) > 0 then
// already registered so unregister and re-register
li_rc = inv_Cache.of_UnRegister(CACHE_ID)
end if
li_rc = inv_Cache.of_Register(CACHE_ID, as_dataobject, atr_obj, false)
else
li_rc = -1
end if
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(CACHE_ID) > 0 then
// already registered so unregister and re-register
li_rc = inv_Cache.of_UnRegister(CACHE_ID)
end if
li_rc = inv_Cache.of_Register(CACHE_ID, atr_obj, as_sql, false)
else
li_rc = -1
end if
case inv_Cache.DATAOBJECTDATA
// register a dataobject
if Len(as_dataobject) <> 0 and not IsNull(as_dataobject) then
if inv_Cache.of_IsRegistered(CACHE_ID) > 0 then
// already registered so unregister and re-register
li_rc = inv_Cache.of_UnRegister(CACHE_ID)
end if
li_rc = inv_Cache.of_Register(CACHE_ID, as_dataobject)
else
li_rc = -1
end if
case else
// didn't register anything
li_rc = -1
end choose
return li_rc
end function