@Override public Object createStatement(Object proxy,Method method,Object[] args,Object statement,long time){
  try {
    Object result=null;
    String name=method.getName();
    String sql=null;
    Constructor<?> constructor=null;
    if (compare(CREATE_STATEMENT,name)) {
      constructor=getConstructor(CREATE_STATEMENT_IDX,Statement.class);
    }
 else     if (compare(PREPARE_STATEMENT,name)) {
      sql=(String)args[0];
      constructor=getConstructor(PREPARE_STATEMENT_IDX,PreparedStatement.class);
      if (sql != null) {
        prepareStatement(sql,time);
      }
    }
 else     if (compare(PREPARE_CALL,name)) {
      sql=(String)args[0];
      constructor=getConstructor(PREPARE_CALL_IDX,CallableStatement.class);
      prepareCall(sql,time);
    }
 else {
      return statement;
    }
    result=constructor.newInstance(new Object[]{new StatementProxy(statement,sql)});
    return result;
  }
 catch (  Exception x) {
    log.warn("Unable to create statement proxy for slow query report.",x);
  }
  return statement;
}

@ Override public Object createStatement ( Object proxy , Method method , Object [ ] args , Object statement , long time ) { try { Object result = null ; String name = method . getName ( ) ; String sql = null ; Constructor < ? > constructor = null ; if ( compare ( CREATE_STATEMENT , name ) ) { constructor = getConstructor ( CREATE_STATEMENT_IDX , Statement . class ) ; } else if ( compare ( PREPARE_STATEMENT , name ) ) { sql = ( String ) args [ 0 ] ; constructor = getConstructor ( PREPARE_STATEMENT_IDX , PreparedStatement . class ) ; if ( sql != null ) { prepareStatement ( sql , time ) ; } } else if ( compare ( PREPARE_CALL , name ) ) { sql = ( String ) args [ 0 ] ; constructor = getConstructor ( PREPARE_CALL_IDX , CallableStatement . class ) ; prepareCall ( sql , time ) ; } else { return statement ; } result = constructor . newInstance ( new Object [ ] { new StatementProxy ( statement , sql ) } ) ; return result ; } catch ( Exception x ) { log . warn ( "Unable to create statement proxy for slow query report." , x ) ; } return statement ; }
creates a statement interceptor to monitor query response times
