當前位置: 首頁>>代碼示例>>Java>>正文


Java StatementHandler.parameterize方法代碼示例

本文整理匯總了Java中org.apache.ibatis.executor.statement.StatementHandler.parameterize方法的典型用法代碼示例。如果您正苦於以下問題:Java StatementHandler.parameterize方法的具體用法?Java StatementHandler.parameterize怎麽用?Java StatementHandler.parameterize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.ibatis.executor.statement.StatementHandler的用法示例。


在下文中一共展示了StatementHandler.parameterize方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doQuery

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql)
    throws SQLException {
  Statement stmt = null;
  try {
    flushStatements();
    Configuration configuration = ms.getConfiguration();
    StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameterObject, rowBounds, resultHandler, boundSql);
    Connection connection = getConnection(ms.getStatementLog());
    stmt = handler.prepare(connection, transaction.getTimeout());
    handler.parameterize(stmt);
    return handler.<E>query(stmt, resultHandler);
  } finally {
    closeStatement(stmt);
  }
}
 
開發者ID:yuexiahandao,項目名稱:MybatisCode,代碼行數:17,代碼來源:BatchExecutor.java

示例2: prepareStatement

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
private Statement prepareStatement(StatementHandler handler, Log statementLog) throws SQLException {
  Statement stmt;
  //得到綁定的SQL語句
  BoundSql boundSql = handler.getBoundSql();
  String sql = boundSql.getSql();
  //如果緩存中已經有了,直接得到Statement
  if (hasStatementFor(sql)) {
    stmt = getStatement(sql);
  } else {
    //如果緩存沒有找到,則和SimpleExecutor處理完全一樣,然後加入緩存
    Connection connection = getConnection(statementLog);
    stmt = handler.prepare(connection);
    putStatement(sql, stmt);
  }
  handler.parameterize(stmt);
  return stmt;
}
 
開發者ID:shurun19851206,項目名稱:mybaties,代碼行數:18,代碼來源:ReuseExecutor.java

示例3: doUpdate

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
@Override
public int doUpdate(MappedStatement ms, Object parameterObject) throws SQLException {
  final Configuration configuration = ms.getConfiguration();
  final StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, RowBounds.DEFAULT, null, null);
  final BoundSql boundSql = handler.getBoundSql();
  final String sql = boundSql.getSql();
  final Statement stmt;
  if (sql.equals(currentSql) && ms.equals(currentStatement)) {
    int last = statementList.size() - 1;
    stmt = statementList.get(last);
    BatchResult batchResult = batchResultList.get(last);
    batchResult.addParameterObject(parameterObject);
  } else {
    Connection connection = getConnection(ms.getStatementLog());
    stmt = handler.prepare(connection);
    currentSql = sql;
    currentStatement = ms;
    statementList.add(stmt);
    batchResultList.add(new BatchResult(ms, sql, parameterObject));
  }
  handler.parameterize(stmt);
  handler.batch(stmt);
  return BATCH_UPDATE_RETURN_VALUE;
}
 
開發者ID:shurun19851206,項目名稱:mybaties,代碼行數:25,代碼來源:BatchExecutor.java

示例4: doQuery

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
@Override
public <E> List<E> doQuery(MappedStatement ms, Object parameterObject, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql)
    throws SQLException {
  Statement stmt = null;
  try {
    flushStatements();
    Configuration configuration = ms.getConfiguration();
    StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameterObject, rowBounds, resultHandler, boundSql);
    Connection connection = getConnection(ms.getStatementLog());
    stmt = handler.prepare(connection);
    handler.parameterize(stmt);
    return handler.<E>query(stmt, resultHandler);
  } finally {
    closeStatement(stmt);
  }
}
 
開發者ID:shurun19851206,項目名稱:mybaties,代碼行數:17,代碼來源:BatchExecutor.java

示例5: doUpdate

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
@Override
public int doUpdate(MappedStatement ms, Object parameterObject) throws SQLException {
  final Configuration configuration = ms.getConfiguration();
  final StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, RowBounds.DEFAULT, null, null);
  final BoundSql boundSql = handler.getBoundSql();
  final String sql = boundSql.getSql();
  final Statement stmt;
  if (sql.equals(currentSql) && ms.equals(currentStatement)) {
    int last = statementList.size() - 1;
    stmt = statementList.get(last);
   handler.parameterize(stmt);//fix Issues 322
    BatchResult batchResult = batchResultList.get(last);
    batchResult.addParameterObject(parameterObject);
  } else {
    Connection connection = getConnection(ms.getStatementLog());
    stmt = handler.prepare(connection);
    handler.parameterize(stmt);    //fix Issues 322
    currentSql = sql;
    currentStatement = ms;
    statementList.add(stmt);
    batchResultList.add(new BatchResult(ms, sql, parameterObject));
  }
// handler.parameterize(stmt);
  handler.batch(stmt);
  return BATCH_UPDATE_RETURN_VALUE;
}
 
開發者ID:toulezu,項目名稱:play,代碼行數:27,代碼來源:BatchExecutor.java

示例6: prepareStatement

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
private Statement prepareStatement(StatementHandler handler, Log statementLog) throws SQLException {
  Statement stmt;
  BoundSql boundSql = handler.getBoundSql();
  String sql = boundSql.getSql();
  if (hasStatementFor(sql)) {
    stmt = getStatement(sql);
    applyTransactionTimeout(stmt);
  } else {
    Connection connection = getConnection(statementLog);
    stmt = handler.prepare(connection, transaction.getTimeout());
    putStatement(sql, stmt);
  }
  handler.parameterize(stmt);
  return stmt;
}
 
開發者ID:yuexiahandao,項目名稱:MybatisCode,代碼行數:16,代碼來源:ReuseExecutor.java

示例7: doUpdate

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
@Override
public int doUpdate(MappedStatement ms, Object parameterObject) throws SQLException {
  final Configuration configuration = ms.getConfiguration();
  final StatementHandler handler = configuration.newStatementHandler(this, ms, parameterObject, RowBounds.DEFAULT, null, null);
  final BoundSql boundSql = handler.getBoundSql();
  final String sql = boundSql.getSql();
  final Statement stmt;
  if (sql.equals(currentSql) && ms.equals(currentStatement)) {
    int last = statementList.size() - 1;
    stmt = statementList.get(last);
    applyTransactionTimeout(stmt);
   handler.parameterize(stmt);//fix Issues 322
    BatchResult batchResult = batchResultList.get(last);
    batchResult.addParameterObject(parameterObject);
  } else {
    Connection connection = getConnection(ms.getStatementLog());
    stmt = handler.prepare(connection, transaction.getTimeout());
    handler.parameterize(stmt);    //fix Issues 322
    currentSql = sql;
    currentStatement = ms;
    statementList.add(stmt);
    batchResultList.add(new BatchResult(ms, sql, parameterObject));
  }
// handler.parameterize(stmt);
  handler.batch(stmt);
  return BATCH_UPDATE_RETURN_VALUE;
}
 
開發者ID:yuexiahandao,項目名稱:MybatisCode,代碼行數:28,代碼來源:BatchExecutor.java

示例8: doQueryCursor

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
@Override
protected <E> Cursor<E> doQueryCursor(MappedStatement ms, Object parameter, RowBounds rowBounds, BoundSql boundSql) throws SQLException {
  flushStatements();
  Configuration configuration = ms.getConfiguration();
  StatementHandler handler = configuration.newStatementHandler(wrapper, ms, parameter, rowBounds, null, boundSql);
  Connection connection = getConnection(ms.getStatementLog());
  Statement stmt = handler.prepare(connection, transaction.getTimeout());
  handler.parameterize(stmt);
  return handler.<E>queryCursor(stmt);
}
 
開發者ID:yuexiahandao,項目名稱:MybatisCode,代碼行數:11,代碼來源:BatchExecutor.java

示例9: prepareStatement

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
private Statement prepareStatement(StatementHandler handler, Log statementLog) throws SQLException {
  Statement stmt;
  Connection connection = getConnection(statementLog);
  stmt = handler.prepare(connection, transaction.getTimeout());
  handler.parameterize(stmt);
  return stmt;
}
 
開發者ID:yuexiahandao,項目名稱:MybatisCode,代碼行數:8,代碼來源:SimpleExecutor.java

示例10: prepareStatement

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
private Statement prepareStatement(StatementHandler handler, Log statementLog) throws SQLException {
  Statement stmt;
  // 源碼解析: 獲取數據庫連接
  Connection connection = getConnection(statementLog);
  // 源碼解析: 創建Statement
  stmt = handler.prepare(connection, transaction.getTimeout());
  handler.parameterize(stmt);
  return stmt;
}
 
開發者ID:txazo,項目名稱:mybatis,代碼行數:10,代碼來源:SimpleExecutor.java

示例11: prepareStatement

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
private Statement prepareStatement(StatementHandler handler, Log statementLog) throws SQLException {
  Statement stmt;
  Connection connection = getConnection(statementLog);
  //調用StatementHandler.prepare
  stmt = handler.prepare(connection);
  //調用StatementHandler.parameterize
  handler.parameterize(stmt);
  return stmt;
}
 
開發者ID:shurun19851206,項目名稱:mybaties,代碼行數:10,代碼來源:SimpleExecutor.java

示例12: prepareStatement

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
private Statement prepareStatement(StatementHandler handler, Log statementLog) throws SQLException {
  Statement stmt;
  BoundSql boundSql = handler.getBoundSql();
  String sql = boundSql.getSql();
  if (hasStatementFor(sql)) {
    stmt = getStatement(sql);
  } else {
    Connection connection = getConnection(statementLog);
    stmt = handler.prepare(connection);
    putStatement(sql, stmt);
  }
  handler.parameterize(stmt);
  return stmt;
}
 
開發者ID:toulezu,項目名稱:play,代碼行數:15,代碼來源:ReuseExecutor.java

示例13: prepareStatement

import org.apache.ibatis.executor.statement.StatementHandler; //導入方法依賴的package包/類
private Statement prepareStatement(StatementHandler handler, Log statementLog) throws SQLException {
  Statement stmt;
  Connection connection = getConnection(statementLog);
  stmt = handler.prepare(connection);
  //對創建的Statement對象設置參數,即設置SQL 語句中 ? 設置為指定的參數
  handler.parameterize(stmt);
  return stmt;
}
 
開發者ID:toulezu,項目名稱:play,代碼行數:9,代碼來源:SimpleExecutor.java


注:本文中的org.apache.ibatis.executor.statement.StatementHandler.parameterize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。