123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- $PBExportHeader$f_setsysoplog.srf
- global type f_setsysoplog from function_object
- end type
- forward prototypes
- global function integer f_setsysoplog (string arg_logtype, string arg_dscrp, ref string arg_msg, boolean arg_ifcommit)
- end prototypes
- global function integer f_setsysoplog (string arg_logtype, string arg_dscrp, ref string arg_msg, boolean arg_ifcommit);//f_setsysoplog(arg_logtype,arg_dscrp,arg_msg,arg_ifcommit)
- int rslt = 1
- long logid = 0,maxid
- //****trycreate_sys_oplog
- long cnt
- string createsql_string,t_str
- //createsql_string="create table sys_oplog ( logid int not null primary key, logtype char (20) not null default ('') , dscrp varchar (250) not null default ('') ,optime datetime null, opemp char(10) null )"
- //t_str="select count(*) from sys_oplog"
- //
- //execute immediate :t_str;
- //if sqlca.sqlcode<>0 then //不存在该表,建立
- //
- // execute immediate :createsql_string ;
- //
- // if sqlca.sqlcode<>0 then
- // arg_msg='建立表sys_oplog失败>>'+sqlca.sqlerrtext
- // rollback ;
- // rslt=0
- // goto ext
- // else
- // commit ;
- // end if
- //end if
- //********************
- select max(logid) into :maxid from sys_oplog;
- if sqlca.sqlcode <> 0 then
- maxid = 10
- end if
- if isnull(maxid) then maxid = 10
- logid = maxid + 1
- insert into sys_oplog
- ( logid,
- logtype,
- dscrp,
- optime,
- opemp )
- values ( :logid,
- :arg_logtype,
- :arg_dscrp,
- getdate(),
- :publ_operator ) ;
- if sqlca.sqlcode <> 0 then
- rollback;
- rslt = 0
- goto ext
- end if
- ext:
- if rslt = 1 and arg_ifcommit then
- commit;
- end if
- return rslt
- end function
|