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

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

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

JdbcTemplate.getSql介绍

[英]Determine SQL from potential provider object.
[中]从潜在的提供程序对象确定SQL。

代码示例

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

Assert.notNull(action, "Callback object must not be null");
if (logger.isDebugEnabled()) {
  String sql = getSql(csc);
  logger.debug("Calling stored procedure" + (sql != null ? " [" + sql  + "]" : ""));
    ((ParameterDisposer) csc).cleanupParameters();
  String sql = getSql(csc);
  JdbcUtils.closeStatement(cs);
  cs = null;

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

Assert.notNull(action, "Callback object must not be null");
if (logger.isDebugEnabled()) {
  String sql = getSql(psc);
  logger.debug("Executing prepared SQL statement" + (sql != null ? " [" + sql + "]" : ""));
    ((ParameterDisposer) psc).cleanupParameters();
  String sql = getSql(psc);
  JdbcUtils.closeStatement(ps);
  ps = null;

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

@Override
@Nullable
public <T> T execute(ConnectionCallback<T> action) throws DataAccessException {
  Assert.notNull(action, "Callback object must not be null");
  Connection con = DataSourceUtils.getConnection(obtainDataSource());
  try {
    // Create close-suppressing Connection proxy, also preparing returned Statements.
    Connection conToUse = createConnectionProxy(con);
    return action.doInConnection(conToUse);
  }
  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);
    DataSourceUtils.releaseConnection(con, getDataSource());
    con = null;
    throw translateException("ConnectionCallback", sql, ex);
  }
  finally {
    DataSourceUtils.releaseConnection(con, getDataSource());
  }
}

代码示例来源: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: org.springframework/org.springframework.jdbc

Assert.notNull(action, "Callback object must not be null");
if (logger.isDebugEnabled()) {
  String sql = getSql(csc);
  logger.debug("Calling stored procedure" + (sql != null ? " [" + sql  + "]" : ""));
    ((ParameterDisposer) csc).cleanupParameters();
  String sql = getSql(csc);
  csc = null;
  JdbcUtils.closeStatement(cs);

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

Assert.notNull(action, "Callback object must not be null");
if (logger.isDebugEnabled()) {
  String sql = getSql(psc);
  logger.debug("Executing prepared SQL statement" + (sql != null ? " [" + sql + "]" : ""));
    ((ParameterDisposer) psc).cleanupParameters();
  String sql = getSql(psc);
  psc = null;
  JdbcUtils.closeStatement(ps);

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

public <T> T execute(ConnectionCallback<T> action) throws DataAccessException {
  Assert.notNull(action, "Callback object must not be null");
  Connection con = DataSourceUtils.getConnection(getDataSource());
  try {
    Connection conToUse = con;
    if (this.nativeJdbcExtractor != null) {
      // Extract native JDBC Connection, castable to OracleConnection or the like.
      conToUse = this.nativeJdbcExtractor.getNativeConnection(con);
    }
    else {
      // Create close-suppressing Connection proxy, also preparing returned Statements.
      conToUse = createConnectionProxy(con);
    }
    return action.doInConnection(conToUse);
  }
  catch (SQLException ex) {
    // Release Connection early, to avoid potential connection pool deadlock
    // in the case when the exception translator hasn't been initialized yet.
    DataSourceUtils.releaseConnection(con, getDataSource());
    con = null;
    throw getExceptionTranslator().translate("ConnectionCallback", getSql(action), ex);
  }
  finally {
    DataSourceUtils.releaseConnection(con, getDataSource());
  }
}

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

((ParameterDisposer) psc).cleanupParameters();
String sql = getSql(psc);
JdbcUtils.closeStatement(ps);
ps = null;
  ((ParameterDisposer) csc).cleanupParameters();
String sql = getSql(csc);
JdbcUtils.closeStatement(cs);
cs = null;

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

DataSourceUtils.releaseConnection(con, getDataSource());
con = null;
throw getExceptionTranslator().translate("StatementCallback", getSql(action), ex);

相关文章