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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StatementLogSqlSession.SqlStatementLog
static class
StatementLogSqlSession.SqlStatementType
-
Field Summary
Fields Modifier and Type Field Description protected static ThreadLocal<List<StatementLogSqlSession.SqlStatementLog>>
threadStatementLog
-
Fields inherited from class org.camunda.bpm.qa.performance.engine.util.DelegatingSqlSession
wrappedSession
-
-
Constructor Summary
Constructors Constructor Description StatementLogSqlSession(org.apache.ibatis.session.SqlSession wrappedSession)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
delete(String statement)
int
delete(String statement, Object parameter)
int
insert(String statement)
int
insert(String statement, Object paremeter)
protected void
logStatement(StatementLogSqlSession.SqlStatementType type, Object parameters, String statement, long duration)
void
select(String statement, Object parameter, org.apache.ibatis.session.ResultHandler handler)
void
select(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler handler)
void
select(String statement, org.apache.ibatis.session.ResultHandler handler)
<E> List<E>
selectList(String statement)
<E> List<E>
selectList(String statement, Object parameter)
<E> List<E>
selectList(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)
<K,V>
Map<K,V>selectMap(String statement, Object parameter, String mapKey)
<K,V>
Map<K,V>selectMap(String statement, Object parameter, String mapKey, org.apache.ibatis.session.RowBounds rowBounds)
<K,V>
Map<K,V>selectMap(String statement, String mapKey)
<T> T
selectOne(String statement)
<T> T
selectOne(String statement, Object parameter)
static void
startLogging()
starts logging any statements executed by the calling thread.static List<StatementLogSqlSession.SqlStatementLog>
stopLogging()
stops logging statement executed by the current thread and returns the list of logged statements.int
update(String statement)
int
update(String statement, Object parameter)
-
Methods inherited from class org.camunda.bpm.qa.performance.engine.util.DelegatingSqlSession
clearCache, close, commit, commit, flushStatements, getConfiguration, getConnection, getMapper, rollback, rollback, selectCursor, selectCursor, selectCursor
-
-
-
-
Field Detail
-
threadStatementLog
protected static ThreadLocal<List<StatementLogSqlSession.SqlStatementLog>> threadStatementLog
-
-
Method Detail
-
delete
public int delete(String statement)
- Specified by:
delete
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
delete
in classDelegatingSqlSession
-
delete
public int delete(String statement, Object parameter)
- Specified by:
delete
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
delete
in classDelegatingSqlSession
-
insert
public int insert(String statement)
- Specified by:
insert
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
insert
in classDelegatingSqlSession
-
insert
public int insert(String statement, Object paremeter)
- Specified by:
insert
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
insert
in classDelegatingSqlSession
-
update
public int update(String statement)
- Specified by:
update
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
update
in classDelegatingSqlSession
-
update
public int update(String statement, Object parameter)
- Specified by:
update
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
update
in classDelegatingSqlSession
-
select
public void select(String statement, Object parameter, org.apache.ibatis.session.ResultHandler handler)
- Specified by:
select
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
select
in classDelegatingSqlSession
-
select
public void select(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler handler)
- Specified by:
select
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
select
in classDelegatingSqlSession
-
select
public void select(String statement, org.apache.ibatis.session.ResultHandler handler)
- Specified by:
select
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
select
in classDelegatingSqlSession
-
selectList
public <E> List<E> selectList(String statement)
- Specified by:
selectList
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectList
in classDelegatingSqlSession
-
selectList
public <E> List<E> selectList(String statement, Object parameter)
- Specified by:
selectList
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectList
in classDelegatingSqlSession
-
selectList
public <E> List<E> selectList(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)
- Specified by:
selectList
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectList
in classDelegatingSqlSession
-
selectMap
public <K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey)
- Specified by:
selectMap
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectMap
in classDelegatingSqlSession
-
selectMap
public <K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, org.apache.ibatis.session.RowBounds rowBounds)
- Specified by:
selectMap
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectMap
in classDelegatingSqlSession
-
selectMap
public <K,V> Map<K,V> selectMap(String statement, String mapKey)
- Specified by:
selectMap
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectMap
in classDelegatingSqlSession
-
selectOne
public <T> T selectOne(String statement)
- Specified by:
selectOne
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectOne
in classDelegatingSqlSession
-
selectOne
public <T> T selectOne(String statement, Object parameter)
- Specified by:
selectOne
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectOne
in classDelegatingSqlSession
-
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.
-
-