org.springframework.jdbc.core.JdbcTemplate.applyStatementSettings()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中org.springframework.jdbc.core.JdbcTemplate.applyStatementSettings()方法的一些代码示例,展示了JdbcTemplate.applyStatementSettings()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JdbcTemplate.applyStatementSettings()方法的具体详情如下:
包路径:org.springframework.jdbc.core.JdbcTemplate
类名称:JdbcTemplate
方法名:applyStatementSettings

JdbcTemplate.applyStatementSettings介绍

[英]Prepare the given JDBC Statement (or PreparedStatement or CallableStatement), applying statement settings such as fetch size, max rows, and query timeout.
[中]准备给定的JDBC语句(或PreparedStatement或CallableStatement),应用诸如fetch size、max rows和查询超时等语句设置。

代码示例

代码示例来源:origin: spring-projects/spring-framework

applyStatementSettings(((Statement) retVal));

代码示例来源:origin: spring-projects/spring-framework

@Override
@Nullable
public <T> T execute(StatementCallback<T> action) throws DataAccessException {
  Assert.notNull(action, "Callback object must not be null");
  Connection con = DataSourceUtils.getConnection(obtainDataSource());
  Statement stmt = null;
  try {
    stmt = con.createStatement();
    applyStatementSettings(stmt);
    T result = action.doInStatement(stmt);
    handleWarnings(stmt);
    return result;
  }
  catch (SQLException ex) {
    // Release Connection early, to avoid potential connection pool deadlock
    // in the case when the exception translator hasn't been initialized yet.
    String sql = getSql(action);
    JdbcUtils.closeStatement(stmt);
    stmt = null;
    DataSourceUtils.releaseConnection(con, getDataSource());
    con = null;
    throw translateException("StatementCallback", sql, ex);
  }
  finally {
    JdbcUtils.closeStatement(stmt);
    DataSourceUtils.releaseConnection(con, getDataSource());
  }
}

代码示例来源:origin: spring-projects/spring-framework

try {
  cs = csc.createCallableStatement(con);
  applyStatementSettings(cs);
  T result = action.doInCallableStatement(cs);
  handleWarnings(cs);

代码示例来源:origin: spring-projects/spring-framework

try {
  ps = psc.createPreparedStatement(con);
  applyStatementSettings(ps);
  T result = action.doInPreparedStatement(ps);
  handleWarnings(ps);

代码示例来源:origin: apache/servicemix-bundles

applyStatementSettings(((Statement) retVal));

代码示例来源:origin: org.springframework/org.springframework.jdbc

applyStatementSettings(((Statement) retVal));

代码示例来源:origin: org.springframework/org.springframework.jdbc

applyStatementSettings(cs);
CallableStatement csToUse = cs;
if (this.nativeJdbcExtractor != null) {

代码示例来源:origin: org.springframework/org.springframework.jdbc

applyStatementSettings(ps);
PreparedStatement psToUse = ps;
if (this.nativeJdbcExtractor != null) {

代码示例来源:origin: org.springframework/org.springframework.jdbc

applyStatementSettings(stmt);
Statement stmtToUse = stmt;
if (this.nativeJdbcExtractor != null) {

相关文章