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

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

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

JdbcTemplate.getMaxRows介绍

[英]Return the maximum number of rows specified for this JdbcTemplate.
[中]返回为此JdbcTemplate指定的最大行数。

代码示例

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

/**
 * Prepare the given JDBC Statement (or PreparedStatement or CallableStatement),
 * applying statement settings such as fetch size, max rows, and query timeout.
 * @param stmt the JDBC Statement to prepare
 * @throws SQLException if thrown by JDBC API
 * @see #setFetchSize
 * @see #setMaxRows
 * @see #setQueryTimeout
 * @see org.springframework.jdbc.datasource.DataSourceUtils#applyTransactionTimeout
 */
protected void applyStatementSettings(Statement stmt) throws SQLException {
  int fetchSize = getFetchSize();
  if (fetchSize != -1) {
    stmt.setFetchSize(fetchSize);
  }
  int maxRows = getMaxRows();
  if (maxRows != -1) {
    stmt.setMaxRows(maxRows);
  }
  DataSourceUtils.applyTimeout(stmt, getDataSource(), getQueryTimeout());
}

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

@Test
public void parameterPropagation() {
  SqlOperation operation = new SqlOperation() {};
  DataSource ds = new DriverManagerDataSource();
  operation.setDataSource(ds);
  operation.setFetchSize(10);
  operation.setMaxRows(20);
  JdbcTemplate jt = operation.getJdbcTemplate();
  assertEquals(ds, jt.getDataSource());
  assertEquals(10, jt.getFetchSize());
  assertEquals(20, jt.getMaxRows());
}

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

@Test
public void testConfig() {
  assertNotNull(jdbcPagingItemReader);
  NamedParameterJdbcTemplate namedParameterJdbcTemplate = (NamedParameterJdbcTemplate)
      ReflectionTestUtils.getField(jdbcPagingItemReader, "namedParameterJdbcTemplate");
  JdbcTemplate jdbcTemplate = (JdbcTemplate) namedParameterJdbcTemplate.getJdbcOperations();
  assertEquals(1000, jdbcTemplate.getMaxRows());
  assertEquals(100, jdbcTemplate.getFetchSize());
}

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

@Override
  public void doSomething() {
    this.jdbcTemplate.getMaxRows();
  }
}

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

public int getMaxRows() {
 return delegate.getMaxRows();
}

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

public int getMaxRows() {
 return delegate.getMaxRows();
}

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

/**
 * Prepare the given JDBC Statement (or PreparedStatement or CallableStatement),
 * applying statement settings such as fetch size, max rows, and query timeout.
 * @param stmt the JDBC Statement to prepare
 * @throws SQLException if thrown by JDBC API
 * @see #setFetchSize
 * @see #setMaxRows
 * @see #setQueryTimeout
 * @see org.springframework.jdbc.datasource.DataSourceUtils#applyTransactionTimeout
 */
protected void applyStatementSettings(Statement stmt) throws SQLException {
  int fetchSize = getFetchSize();
  if (fetchSize > 0) {
    stmt.setFetchSize(fetchSize);
  }
  int maxRows = getMaxRows();
  if (maxRows > 0) {
    stmt.setMaxRows(maxRows);
  }
  DataSourceUtils.applyTimeout(stmt, getDataSource(), getQueryTimeout());
}

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

/**
 * Prepare the given JDBC Statement (or PreparedStatement or CallableStatement),
 * applying statement settings such as fetch size, max rows, and query timeout.
 * @param stmt the JDBC Statement to prepare
 * @throws SQLException if thrown by JDBC API
 * @see #setFetchSize
 * @see #setMaxRows
 * @see #setQueryTimeout
 * @see org.springframework.jdbc.datasource.DataSourceUtils#applyTransactionTimeout
 */
protected void applyStatementSettings(Statement stmt) throws SQLException {
  int fetchSize = getFetchSize();
  if (fetchSize != -1) {
    stmt.setFetchSize(fetchSize);
  }
  int maxRows = getMaxRows();
  if (maxRows != -1) {
    stmt.setMaxRows(maxRows);
  }
  DataSourceUtils.applyTimeout(stmt, getDataSource(), getQueryTimeout());
}

相关文章