Class StatementLogSqlSession

java.lang.Object
org.camunda.bpm.qa.performance.engine.util.DelegatingSqlSession
org.camunda.bpm.qa.performance.engine.sqlstatementlog.StatementLogSqlSession
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.ibatis.session.SqlSession

public class StatementLogSqlSession extends DelegatingSqlSession

This SqlSession wraps an actual SqlSession and logs executed sql statements. (Calls to the delete*, update*, select*, insert* methods.)

Author:
Daniel Meyer
  • Field Details

  • Constructor Details

    • StatementLogSqlSession

      public StatementLogSqlSession(org.apache.ibatis.session.SqlSession wrappedSession)
  • Method Details

    • delete

      public int delete(String statement)
      Specified by:
      delete in interface org.apache.ibatis.session.SqlSession
      Overrides:
      delete in class DelegatingSqlSession
    • delete

      public int delete(String statement, Object parameter)
      Specified by:
      delete in interface org.apache.ibatis.session.SqlSession
      Overrides:
      delete in class DelegatingSqlSession
    • insert

      public int insert(String statement)
      Specified by:
      insert in interface org.apache.ibatis.session.SqlSession
      Overrides:
      insert in class DelegatingSqlSession
    • insert

      public int insert(String statement, Object paremeter)
      Specified by:
      insert in interface org.apache.ibatis.session.SqlSession
      Overrides:
      insert in class DelegatingSqlSession
    • update

      public int update(String statement)
      Specified by:
      update in interface org.apache.ibatis.session.SqlSession
      Overrides:
      update in class DelegatingSqlSession
    • update

      public int update(String statement, Object parameter)
      Specified by:
      update in interface org.apache.ibatis.session.SqlSession
      Overrides:
      update in class DelegatingSqlSession
    • select

      public void select(String statement, Object parameter, org.apache.ibatis.session.ResultHandler handler)
      Specified by:
      select in interface org.apache.ibatis.session.SqlSession
      Overrides:
      select in class DelegatingSqlSession
    • select

      public void select(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler handler)
      Specified by:
      select in interface org.apache.ibatis.session.SqlSession
      Overrides:
      select in class DelegatingSqlSession
    • select

      public void select(String statement, org.apache.ibatis.session.ResultHandler handler)
      Specified by:
      select in interface org.apache.ibatis.session.SqlSession
      Overrides:
      select in class DelegatingSqlSession
    • selectList

      public <E> List<E> selectList(String statement)
      Specified by:
      selectList in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectList in class DelegatingSqlSession
    • selectList

      public <E> List<E> selectList(String statement, Object parameter)
      Specified by:
      selectList in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectList in class DelegatingSqlSession
    • selectList

      public <E> List<E> selectList(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)
      Specified by:
      selectList in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectList in class DelegatingSqlSession
    • selectMap

      public <K, V> Map<K,V> selectMap(String statement, Object parameter, String mapKey)
      Specified by:
      selectMap in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectMap in class DelegatingSqlSession
    • selectMap

      public <K, V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, org.apache.ibatis.session.RowBounds rowBounds)
      Specified by:
      selectMap in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectMap in class DelegatingSqlSession
    • selectMap

      public <K, V> Map<K,V> selectMap(String statement, String mapKey)
      Specified by:
      selectMap in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectMap in class DelegatingSqlSession
    • selectOne

      public <T> T selectOne(String statement)
      Specified by:
      selectOne in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectOne in class DelegatingSqlSession
    • selectOne

      public <T> T selectOne(String statement, Object parameter)
      Specified by:
      selectOne in interface org.apache.ibatis.session.SqlSession
      Overrides:
      selectOne in class DelegatingSqlSession
    • logStatement

      protected void logStatement(StatementLogSqlSession.SqlStatementType type, Object parameters, String statement, long duration)
    • stopLogging

      public static List<StatementLogSqlSession.SqlStatementLog> stopLogging()
      stops logging statement executed by the current thread and returns the list of logged statements.
      Returns:
      the List of logged sql statements
    • startLogging

      public static void startLogging()
      starts logging any statements executed by the calling thread.