/* 开始记录日志 */ public void executeCommon_BEGINDBTRACE(Object obj) throws CallDbException { Dbtrace dbtrace = (Dbtrace) obj; SqlParameterExt spx = new SqlParameterExt(); spx.add(new StringValue(dbtrace.getDbtrace_id())); spx.add(new LongValue(dbtrace.getUserid())); spx.add(new StringValue(dbtrace.getIp())); spx.add(new StringValue(dbtrace.getModule_name())); spx.add(new StringValue(dbtrace.getWebservice_method())); // spx.add(new StringValue(dbtrace.getMethod_name())); spx.add(new TimeValue(dbtrace.getStart_time())); String sql = "insert into t_wa_sys_dbtrace(dbtrace_id,userid,ip,module_name,webservice_method,start_time) values(?,?,?,?,?,?)"; bo.setSqlParameterExt(spx); try { bo.execute(sql); bo.clearParameters(); } catch (Exception err) { xlog.error("开始数据跟踪不成功:" + err.getMessage()); throw new CallDbException("开始数据跟踪不成功!"); } }
/* 结束日志记录 */ public void executeCommon_ENDDBTRACE(Object obj) throws CallDbException { Dbtrace dbtrace = (Dbtrace) obj; SqlParameterExt spx = new SqlParameterExt(); spx.add(new TimeValue(dbtrace.getEnd_time())); spx.add(new DoubleValue(dbtrace.getDuration())); spx.add(new IntValue(dbtrace.getRet_count())); spx.add(new StringValue(dbtrace.getMethod_name())); spx.add(new StringValue(dbtrace.getDbtrace_id())); String sql = "update t_wa_sys_dbtrace set end_time=?, duration=?, ret_count=?,sql_code=? where dbtrace_id=?"; bo.setSqlParameterExt(spx); try { bo.execute(sql); bo.clearParameters(); } catch (Exception err) { xlog.error("结束数据跟踪不成功:" + err.getMessage()); throw new CallDbException("结束数据跟踪不成功!"); } }