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

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

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

JdbcTemplate.isIgnoreWarnings介绍

[英]Return whether or not we ignore SQLWarnings.
[中]返回是否忽略SQLWarnings。

代码示例

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

/**
 * Throw an SQLWarningException if we're not ignoring warnings,
 * else log the warnings (at debug level).
 * @param stmt the current JDBC statement
 * @throws SQLWarningException if not ignoring warnings
 * @see org.springframework.jdbc.SQLWarningException
 */
protected void handleWarnings(Statement stmt) throws SQLException {
  if (isIgnoreWarnings()) {
    if (logger.isDebugEnabled()) {
      SQLWarning warningToLog = stmt.getWarnings();
      while (warningToLog != null) {
        logger.debug("SQLWarning ignored: SQL state '" + warningToLog.getSQLState() + "', error code '" +
            warningToLog.getErrorCode() + "', message [" + warningToLog.getMessage() + "]");
        warningToLog = warningToLog.getNextWarning();
      }
    }
  }
  else {
    handleWarnings(stmt.getWarnings());
  }
}

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

@Test
public void testBeanProperties() throws Exception {
  assertTrue("datasource ok", this.template.getDataSource() == this.dataSource);
  assertTrue("ignores warnings by default", this.template.isIgnoreWarnings());
  this.template.setIgnoreWarnings(false);
  assertTrue("can set NOT to ignore warnings", !this.template.isIgnoreWarnings());
}

代码示例来源:origin: io.bufferslayer/bufferslayer-spring-jdbc

public boolean isIgnoreWarnings() {
 return delegate.isIgnoreWarnings();
}

代码示例来源:origin: io.bufferslayer/buffer-spring-jdbc

public boolean isIgnoreWarnings() {
 return delegate.isIgnoreWarnings();
}

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

/**
 * Throw an SQLWarningException if we're not ignoring warnings,
 * else log the warnings (at debug level).
 * @param stmt the current JDBC statement
 * @throws SQLWarningException if not ignoring warnings
 * @see org.springframework.jdbc.SQLWarningException
 */
protected void handleWarnings(Statement stmt) throws SQLException {
  if (isIgnoreWarnings()) {
    if (logger.isDebugEnabled()) {
      SQLWarning warningToLog = stmt.getWarnings();
      while (warningToLog != null) {
        logger.debug("SQLWarning ignored: SQL state '" + warningToLog.getSQLState() + "', error code '" +
            warningToLog.getErrorCode() + "', message [" + warningToLog.getMessage() + "]");
        warningToLog = warningToLog.getNextWarning();
      }
    }
  }
  else {
    handleWarnings(stmt.getWarnings());
  }
}

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

/**
 * Throw an SQLWarningException if we're not ignoring warnings,
 * else log the warnings (at debug level).
 * @param stmt the current JDBC statement
 * @throws SQLWarningException if not ignoring warnings
 * @see org.springframework.jdbc.SQLWarningException
 */
protected void handleWarnings(Statement stmt) throws SQLException {
  if (isIgnoreWarnings()) {
    if (logger.isDebugEnabled()) {
      SQLWarning warningToLog = stmt.getWarnings();
      while (warningToLog != null) {
        logger.debug("SQLWarning ignored: SQL state '" + warningToLog.getSQLState() + "', error code '" +
            warningToLog.getErrorCode() + "', message [" + warningToLog.getMessage() + "]");
        warningToLog = warningToLog.getNextWarning();
      }
    }
  }
  else {
    handleWarnings(stmt.getWarnings());
  }
}

相关文章