Package org.apache.ibatis.executor
Class BaseExecutor
java.lang.Object
org.apache.ibatis.executor.BaseExecutor
- All Implemented Interfaces:
Executor
- Direct Known Subclasses:
BatchExecutor
,ResultLoaderMap.ClosedExecutor
,ReuseExecutor
,SimpleExecutor
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
protected Configuration
protected ConcurrentLinkedQueue<BaseExecutor.DeferredLoad>
protected PerpetualCache
protected PerpetualCache
private static final Log
protected int
protected Transaction
protected Executor
Fields inherited from interface org.apache.ibatis.executor.Executor
NO_RESULT_HANDLER
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseExecutor
(Configuration configuration, Transaction transaction) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyTransactionTimeout
(Statement statement) Apply a transaction timeout.void
void
close
(boolean forceRollback) protected void
closeStatement
(Statement statement) void
commit
(boolean required) createCacheKey
(MappedStatement ms, Object parameterObject, RowBounds rowBounds, BoundSql boundSql) void
deferLoad
(MappedStatement ms, MetaObject resultObject, String property, CacheKey key, Class<?> targetType) protected abstract List<BatchResult>
doFlushStatements
(boolean isRollback) protected abstract <E> List<E>
doQuery
(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) protected abstract <E> Cursor<E>
doQueryCursor
(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) protected abstract int
doUpdate
(MappedStatement ms, Object parameter) flushStatements
(boolean isRollBack) protected Connection
getConnection
(Log statementLog) private void
handleLocallyCachedOutputParameters
(MappedStatement ms, CacheKey key, Object parameter, BoundSql boundSql) boolean
isCached
(MappedStatement ms, CacheKey key) boolean
isClosed()
<E> List<E>
query
(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler) <E> List<E>
query
(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, CacheKey key, BoundSql boundSql) <E> Cursor<E>
queryCursor
(MappedStatement ms, Object parameter, RowBounds rowBounds) private <E> List<E>
queryFromDatabase
(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, CacheKey key, BoundSql boundSql) void
rollback
(boolean required) void
setExecutorWrapper
(Executor wrapper) int
update
(MappedStatement ms, Object parameter)
-
Field Details
-
log
-
transaction
-
wrapper
-
deferredLoads
-
localCache
-
localOutputParameterCache
-
configuration
-
queryStack
protected int queryStack -
closed
private boolean closed
-
-
Constructor Details
-
BaseExecutor
-
-
Method Details
-
getTransaction
- Specified by:
getTransaction
in interfaceExecutor
-
close
public void close(boolean forceRollback) -
isClosed
public boolean isClosed() -
update
- Specified by:
update
in interfaceExecutor
- Throws:
SQLException
-
flushStatements
- Specified by:
flushStatements
in interfaceExecutor
- Throws:
SQLException
-
flushStatements
- Throws:
SQLException
-
query
public <E> List<E> query(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException - Specified by:
query
in interfaceExecutor
- Throws:
SQLException
-
query
public <E> List<E> query(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, CacheKey key, BoundSql boundSql) throws SQLException - Specified by:
query
in interfaceExecutor
- Throws:
SQLException
-
queryCursor
public <E> Cursor<E> queryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds) throws SQLException - Specified by:
queryCursor
in interfaceExecutor
- Throws:
SQLException
-
deferLoad
public void deferLoad(MappedStatement ms, MetaObject resultObject, String property, CacheKey key, Class<?> targetType) -
createCacheKey
public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, RowBounds rowBounds, BoundSql boundSql) - Specified by:
createCacheKey
in interfaceExecutor
-
isCached
-
commit
- Specified by:
commit
in interfaceExecutor
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceExecutor
- Throws:
SQLException
-
clearLocalCache
public void clearLocalCache()- Specified by:
clearLocalCache
in interfaceExecutor
-
doUpdate
- Throws:
SQLException
-
doFlushStatements
- Throws:
SQLException
-
doQuery
protected abstract <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException - Throws:
SQLException
-
doQueryCursor
protected abstract <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException - Throws:
SQLException
-
closeStatement
-
applyTransactionTimeout
Apply a transaction timeout.- Parameters:
statement
- a current statement- Throws:
SQLException
- if a database access error occurs, this method is called on a closedStatement
- Since:
- 3.4.0
- See Also:
-
handleLocallyCachedOutputParameters
private void handleLocallyCachedOutputParameters(MappedStatement ms, CacheKey key, Object parameter, BoundSql boundSql) -
queryFromDatabase
private <E> List<E> queryFromDatabase(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, CacheKey key, BoundSql boundSql) throws SQLException - Throws:
SQLException
-
getConnection
- Throws:
SQLException
-
setExecutorWrapper
- Specified by:
setExecutorWrapper
in interfaceExecutor
-