StatementHandle.java have a bug, please fix in next version

Ask around here!

StatementHandle.java have a bug, please fix in next version

Postby maplexu » Tue May 08, 2012 1:54 am

StatementHandle.java have a bug, after execute sql exception, no execute this.connectionHook.onAfterStatementExecute

example:

wrong is :

Code: Select all
   public boolean execute(String sql)
   throws SQLException {
      boolean result = false;
      checkClosed();
      try {
         if (this.logStatementsEnabled && logger.isDebugEnabled()){
            logger.debug(PoolUtil.fillLogParams(sql, this.logParams));
         }
         long timer = queryTimerStart();
         if (this.connectionHook != null){
            this.connectionHook.onBeforeStatementExecute(this.connectionHandle, this, sql, this.logParams);
         }
         result = this.internalStatement.execute(sql);
         if (this.connectionHook != null){
            this.connectionHook.onAfterStatementExecute(this.connectionHandle, this, sql, this.logParams);
         }
         queryTimerEnd(sql, timer);

      } catch (SQLException e) {
         throw this.connectionHandle.markPossiblyBroken(e);

      }
      return result;
   }


right is :

Code: Select all
   public boolean execute(String sql)
   throws SQLException {
      boolean result = false;
      checkClosed();
      try {
         if (this.logStatementsEnabled && logger.isDebugEnabled()){
            logger.debug(PoolUtil.fillLogParams(sql, this.logParams));
         }
         long timer = queryTimerStart();
         if (this.connectionHook != null){
            this.connectionHook.onBeforeStatementExecute(this.connectionHandle, this, sql, this.logParams);
         }
         result = this.internalStatement.execute(sql);
         if (this.connectionHook != null){
            this.connectionHook.onAfterStatementExecute(this.connectionHandle, this, sql, this.logParams);
         }
         queryTimerEnd(sql, timer);

      } catch (SQLException e) {
         if (this.connectionHook != null){
            this.connectionHook.onAfterStatementExecute(this.connectionHandle, this, sql, this.logParams);
         }
         throw this.connectionHandle.markPossiblyBroken(e);

      }
      return result;
   }
maplexu
 
Posts: 1
Joined: Tue May 08, 2012 1:49 am

Return to BoneCP - Help, Q&A, Whatever!

Who is online

Users browsing this forum: Bing [Bot] and 1 guest