public class StatementLogSqlSession extends DelegatingSqlSession
This SqlSession wraps an actual SqlSession and logs executed sql statements. (Calls to the delete*, update*, select*, insert* methods.)
Modifier and Type | Class and Description |
---|---|
static class |
StatementLogSqlSession.SqlStatementLog |
static class |
StatementLogSqlSession.SqlStatementType |
Modifier and Type | Field and Description |
---|---|
protected static ThreadLocal<List<StatementLogSqlSession.SqlStatementLog>> |
threadStatementLog |
wrappedSession
Constructor and Description |
---|
StatementLogSqlSession(org.apache.ibatis.session.SqlSession wrappedSession) |
Modifier and Type | Method and 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) |
clearCache, close, commit, commit, flushStatements, getConfiguration, getConnection, getMapper, rollback, rollback, selectCursor, selectCursor, selectCursor
protected static ThreadLocal<List<StatementLogSqlSession.SqlStatementLog>> threadStatementLog
public StatementLogSqlSession(org.apache.ibatis.session.SqlSession wrappedSession)
public int delete(String statement)
delete
in interface org.apache.ibatis.session.SqlSession
delete
in class DelegatingSqlSession
public int delete(String statement, Object parameter)
delete
in interface org.apache.ibatis.session.SqlSession
delete
in class DelegatingSqlSession
public int insert(String statement)
insert
in interface org.apache.ibatis.session.SqlSession
insert
in class DelegatingSqlSession
public int insert(String statement, Object paremeter)
insert
in interface org.apache.ibatis.session.SqlSession
insert
in class DelegatingSqlSession
public int update(String statement)
update
in interface org.apache.ibatis.session.SqlSession
update
in class DelegatingSqlSession
public int update(String statement, Object parameter)
update
in interface org.apache.ibatis.session.SqlSession
update
in class DelegatingSqlSession
public void select(String statement, Object parameter, org.apache.ibatis.session.ResultHandler handler)
select
in interface org.apache.ibatis.session.SqlSession
select
in class DelegatingSqlSession
public void select(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler handler)
select
in interface org.apache.ibatis.session.SqlSession
select
in class DelegatingSqlSession
public void select(String statement, org.apache.ibatis.session.ResultHandler handler)
select
in interface org.apache.ibatis.session.SqlSession
select
in class DelegatingSqlSession
public <E> List<E> selectList(String statement)
selectList
in interface org.apache.ibatis.session.SqlSession
selectList
in class DelegatingSqlSession
public <E> List<E> selectList(String statement, Object parameter)
selectList
in interface org.apache.ibatis.session.SqlSession
selectList
in class DelegatingSqlSession
public <E> List<E> selectList(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)
selectList
in interface org.apache.ibatis.session.SqlSession
selectList
in class DelegatingSqlSession
public <K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey)
selectMap
in interface org.apache.ibatis.session.SqlSession
selectMap
in class DelegatingSqlSession
public <K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, org.apache.ibatis.session.RowBounds rowBounds)
selectMap
in interface org.apache.ibatis.session.SqlSession
selectMap
in class DelegatingSqlSession
public <K,V> Map<K,V> selectMap(String statement, String mapKey)
selectMap
in interface org.apache.ibatis.session.SqlSession
selectMap
in class DelegatingSqlSession
public <T> T selectOne(String statement)
selectOne
in interface org.apache.ibatis.session.SqlSession
selectOne
in class DelegatingSqlSession
public <T> T selectOne(String statement, Object parameter)
selectOne
in interface org.apache.ibatis.session.SqlSession
selectOne
in class DelegatingSqlSession
protected void logStatement(StatementLogSqlSession.SqlStatementType type, Object parameters, String statement, long duration)
public static List<StatementLogSqlSession.SqlStatementLog> stopLogging()
List
of logged sql statementspublic static void startLogging()
Copyright © 2019. All rights reserved.