Search in sources :

Example 1 with StatementHandler

use of org.apache.ibatis.executor.statement.StatementHandler in project mybatis-3 by mybatis.

the class Configuration method newStatementHandler.

public StatementHandler newStatementHandler(Executor executor, MappedStatement mappedStatement, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {
    StatementHandler statementHandler = new RoutingStatementHandler(executor, mappedStatement, parameterObject, rowBounds, resultHandler, boundSql);
    statementHandler = (StatementHandler) interceptorChain.pluginAll(statementHandler);
    return statementHandler;
}
Also used : StatementHandler(org.apache.ibatis.executor.statement.StatementHandler) RoutingStatementHandler(org.apache.ibatis.executor.statement.RoutingStatementHandler) RoutingStatementHandler(org.apache.ibatis.executor.statement.RoutingStatementHandler)

Example 2 with StatementHandler

use of org.apache.ibatis.executor.statement.StatementHandler in project mybatis-3 by mybatis.

the class ReuseExecutor method doQuery.

@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
    Configuration configuration = ms.getConfiguration();
    StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, resultHandler, boundSql);
    Statement stmt = prepareStatement(handler, ms.getStatementLog());
    return handler.<E>query(stmt, resultHandler);
}
Also used : Configuration(org.apache.ibatis.session.Configuration) MappedStatement(org.apache.ibatis.mapping.MappedStatement) Statement(java.sql.Statement) StatementHandler(org.apache.ibatis.executor.statement.StatementHandler)

Example 3 with StatementHandler

use of org.apache.ibatis.executor.statement.StatementHandler in project mybatis-3 by mybatis.

the class ReuseExecutor method doUpdate.

@Override
public int doUpdate(MappedStatement ms, Object parameter) throws SQLException {
    Configuration configuration = ms.getConfiguration();
    StatementHandler handler = configuration.newStatementHandler(this, ms, parameter, RowBounds.DEFAULT, null, null);
    Statement stmt = prepareStatement(handler, ms.getStatementLog());
    return handler.update(stmt);
}
Also used : Configuration(org.apache.ibatis.session.Configuration) MappedStatement(org.apache.ibatis.mapping.MappedStatement) Statement(java.sql.Statement) StatementHandler(org.apache.ibatis.executor.statement.StatementHandler)

Example 4 with StatementHandler

use of org.apache.ibatis.executor.statement.StatementHandler in project mybatis-3 by mybatis.

the class ReuseExecutor method doQueryCursor.

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
    Configuration configuration = ms.getConfiguration();
    StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
    Statement stmt = prepareStatement(handler, ms.getStatementLog());
    return handler.<E>queryCursor(stmt);
}
Also used : Configuration(org.apache.ibatis.session.Configuration) MappedStatement(org.apache.ibatis.mapping.MappedStatement) Statement(java.sql.Statement) StatementHandler(org.apache.ibatis.executor.statement.StatementHandler)

Example 5 with StatementHandler

use of org.apache.ibatis.executor.statement.StatementHandler in project mybatis-3 by mybatis.

the class SimpleExecutor method doQueryCursor.

@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
    Configuration configuration = ms.getConfiguration();
    StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
    Statement stmt = prepareStatement(handler, ms.getStatementLog());
    return handler.<E>queryCursor(stmt);
}
Also used : Configuration(org.apache.ibatis.session.Configuration) MappedStatement(org.apache.ibatis.mapping.MappedStatement) Statement(java.sql.Statement) StatementHandler(org.apache.ibatis.executor.statement.StatementHandler)

Aggregations

StatementHandler (org.apache.ibatis.executor.statement.StatementHandler)10 Statement (java.sql.Statement)9 MappedStatement (org.apache.ibatis.mapping.MappedStatement)9 Configuration (org.apache.ibatis.session.Configuration)9 Connection (java.sql.Connection)3 RoutingStatementHandler (org.apache.ibatis.executor.statement.RoutingStatementHandler)1 BoundSql (org.apache.ibatis.mapping.BoundSql)1