Class StatementLogSqlSession
- java.lang.Object
-
- org.camunda.bpm.qa.performance.engine.util.DelegatingSqlSession
-
- org.camunda.bpm.qa.performance.engine.sqlstatementlog.StatementLogSqlSession
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.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 java.lang.ThreadLocal<java.util.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(java.lang.String statement)
int
delete(java.lang.String statement, java.lang.Object parameter)
int
insert(java.lang.String statement)
int
insert(java.lang.String statement, java.lang.Object paremeter)
protected void
logStatement(StatementLogSqlSession.SqlStatementType type, java.lang.Object parameters, java.lang.String statement, long duration)
void
select(java.lang.String statement, java.lang.Object parameter, org.apache.ibatis.session.ResultHandler handler)
void
select(java.lang.String statement, java.lang.Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler handler)
void
select(java.lang.String statement, org.apache.ibatis.session.ResultHandler handler)
<E> java.util.List<E>
selectList(java.lang.String statement)
<E> java.util.List<E>
selectList(java.lang.String statement, java.lang.Object parameter)
<E> java.util.List<E>
selectList(java.lang.String statement, java.lang.Object parameter, org.apache.ibatis.session.RowBounds rowBounds)
<K,V>
java.util.Map<K,V>selectMap(java.lang.String statement, java.lang.Object parameter, java.lang.String mapKey)
<K,V>
java.util.Map<K,V>selectMap(java.lang.String statement, java.lang.Object parameter, java.lang.String mapKey, org.apache.ibatis.session.RowBounds rowBounds)
<K,V>
java.util.Map<K,V>selectMap(java.lang.String statement, java.lang.String mapKey)
<T> T
selectOne(java.lang.String statement)
<T> T
selectOne(java.lang.String statement, java.lang.Object parameter)
static void
startLogging()
starts logging any statements executed by the calling thread.static java.util.List<StatementLogSqlSession.SqlStatementLog>
stopLogging()
stops logging statement executed by the current thread and returns the list of logged statements.int
update(java.lang.String statement)
int
update(java.lang.String statement, java.lang.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 java.lang.ThreadLocal<java.util.List<StatementLogSqlSession.SqlStatementLog>> threadStatementLog
-
-
Method Detail
-
delete
public int delete(java.lang.String statement)
- Specified by:
delete
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
delete
in classDelegatingSqlSession
-
delete
public int delete(java.lang.String statement, java.lang.Object parameter)
- Specified by:
delete
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
delete
in classDelegatingSqlSession
-
insert
public int insert(java.lang.String statement)
- Specified by:
insert
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
insert
in classDelegatingSqlSession
-
insert
public int insert(java.lang.String statement, java.lang.Object paremeter)
- Specified by:
insert
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
insert
in classDelegatingSqlSession
-
update
public int update(java.lang.String statement)
- Specified by:
update
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
update
in classDelegatingSqlSession
-
update
public int update(java.lang.String statement, java.lang.Object parameter)
- Specified by:
update
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
update
in classDelegatingSqlSession
-
select
public void select(java.lang.String statement, java.lang.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(java.lang.String statement, java.lang.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(java.lang.String statement, org.apache.ibatis.session.ResultHandler handler)
- Specified by:
select
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
select
in classDelegatingSqlSession
-
selectList
public <E> java.util.List<E> selectList(java.lang.String statement)
- Specified by:
selectList
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectList
in classDelegatingSqlSession
-
selectList
public <E> java.util.List<E> selectList(java.lang.String statement, java.lang.Object parameter)
- Specified by:
selectList
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectList
in classDelegatingSqlSession
-
selectList
public <E> java.util.List<E> selectList(java.lang.String statement, java.lang.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> java.util.Map<K,V> selectMap(java.lang.String statement, java.lang.Object parameter, java.lang.String mapKey)
- Specified by:
selectMap
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectMap
in classDelegatingSqlSession
-
selectMap
public <K,V> java.util.Map<K,V> selectMap(java.lang.String statement, java.lang.Object parameter, java.lang.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> java.util.Map<K,V> selectMap(java.lang.String statement, java.lang.String mapKey)
- Specified by:
selectMap
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectMap
in classDelegatingSqlSession
-
selectOne
public <T> T selectOne(java.lang.String statement)
- Specified by:
selectOne
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectOne
in classDelegatingSqlSession
-
selectOne
public <T> T selectOne(java.lang.String statement, java.lang.Object parameter)
- Specified by:
selectOne
in interfaceorg.apache.ibatis.session.SqlSession
- Overrides:
selectOne
in classDelegatingSqlSession
-
logStatement
protected void logStatement(StatementLogSqlSession.SqlStatementType type, java.lang.Object parameters, java.lang.String statement, long duration)
-
stopLogging
public static java.util.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.
-
-