Mybatis - PreparedStatementHandler 基础

PreparedStatementHandler 执行流程

Mybatis - PreparedStatementHandler 基础

预处理过程

当缓存都没有命中的情况下,BaseExecutor 会调用字类查询数据库的内容。

SimpleExecutor doQuery 方法

  public <E> List<E> doQuery(MappedStatement ms, Object parameter, RowBounds rowBounds, 
                               ResultHandler resultHandler, BoundSql boundSql) throws SQLException {
    Statement stmt = null;
    try {
      Configuration configuration = ms.getConfiguration();
      StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter,
                                                                rowBounds, resultHandler, boundSql);
      stmt = prepareStatement(handler, ms.getStatementLog());
      return handler.<E>query(stmt, resultHandler);
    } finally {
      closeStatement(stmt);
    }
  }
上一篇:1428. Leftmost Column with at Least a One


下一篇:HardFault_Handler异常