12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- $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
|