File: eaf_n_cst_functionservice.sru
Size: 2489
Date: Tue, 22 Jan 2008 23:40:38 +0100
$PBExportHeader$eaf_n_cst_functionservice.sru
forward
global type eaf_n_cst_functionservice from n_cst_component
end type
end forward

global type eaf_n_cst_functionservice from n_cst_component
event type long executesql ( )
event type long selectsql ( )
event type long servertime ( )
end type
global eaf_n_cst_functionservice eaf_n_cst_functionservice

type variables
Public:
n_cst_argumentservice               inv_argument

end variables

forward prototypes
public function long initialize (string as_document, blob ab_data)
end prototypes

event type long executesql();String ls_sqls, ls_sql[]
n_cst_helperservice lnvo_helper
n_cst_stringservice lnvo_string

inv_argument.GetArgument("sql", ls_sqls)

lnvo_string = create n_cst_stringservice
lnvo_string.ParseStringToArray(ls_sqls, ";", ls_sql)
destroy lnvo_string

lnvo_helper = create n_cst_helperservice
if lnvo_helper.Executesql(ls_sql) = -1 then
   inv_messaging.append(lnvo_helper.inv_messaging )
   destroy lnvo_helper
   return -1
end if
destroy lnvo_helper

return 1
end event

event type long selectsql();n_cst_helperservice lnvo_helper
String ls_sql
Any la_ret[]
Long ll_row

lnvo_helper = create n_cst_helperservice
if lnvo_helper.selectsql(ls_sql, la_ret) = -1 then
   inv_messaging.append(lnvo_helper.inv_messaging )
   destroy lnvo_helper
   return -1
end if
destroy lnvo_helper

for ll_row = 1 to UpperBound(la_ret)
   inv_messaging.Add("returnvalue" + String(ll_row), String(la_ret[ll_row]))
   inv_messaging.Add("returntype" + String(ll_row), ClassName(la_ret[ll_row]))
next

return 1
end event

event type long servertime();n_cst_helperservice lnvo_helper
DateTime ldt_servertime

lnvo_helper = create n_cst_helperservice
if lnvo_helper.servertime(ldt_servertime) = -1 then
   inv_messaging.append(lnvo_helper.inv_messaging )
   destroy lnvo_helper
   return -1
end if
destroy lnvo_helper

inv_messaging.Add("servertime", String(ldt_servertime))

return 1
end event

public function long initialize (string as_document, blob ab_data);inv_argument.initialize(as_document, ab_data)

return 1
end function

on eaf_n_cst_functionservice.create
call super::create
end on

on eaf_n_cst_functionservice.destroy
call super::destroy
end on

event constructor;call super::constructor;inv_argument = create n_cst_argumentservice

end event

event destructor;call super::destructor;if isValid ( inv_argument ) then
   destroy inv_argument
end if
end event