java.sql.ResultSet.setFetchSize()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(530)

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

ResultSet.setFetchSize介绍

[英]Indicates the number of rows to fetch from the database when extra rows are required for this ResultSet. This used as a hint to the JDBC driver.
[中]指示当此结果集需要额外的行时,要从数据库中获取的行数。这被用作对JDBC驱动程序的提示。

代码示例

代码示例来源:origin: apache/incubator-shardingsphere

@Override
  public void execute(final ResultSet resultSet) throws SQLException {
    resultSet.setFetchSize(rows);
  }
});

代码示例来源:origin: codingapi/tx-lcn

@Override
public void setFetchSize(int rows) throws SQLException {
 delegate.setFetchSize(rows);
}

代码示例来源:origin: speedment/speedment

@Override
public void configureSelect(ResultSet resultSet) throws SQLException {
  resultSet.setFetchSize(FETCH_SIZE);
}

代码示例来源:origin: querydsl/querydsl

@Override
public void setFetchSize(int rows) throws SQLException {
  rs.setFetchSize(rows);
}

代码示例来源:origin: alibaba/druid

@Override
public void setFetchSize(int rows) throws SQLException {
  try {
    rs.setFetchSize(rows);
  } catch (Throwable t) {
    throw checkException(t);
  }
}

代码示例来源:origin: spotbugs/spotbugs

@NoWarning("SQL_BAD_RESULTSET_ACCESS")
void notBug(ResultSet any) throws SQLException {
  any.setFetchSize(0);
}

代码示例来源:origin: igniterealtime/Openfire

/**
 * Sets the number of rows that the JDBC driver should buffer at a time.
 * The operation is automatically bypassed if Jive knows that the
 * the JDBC driver or database doesn't support it.
 *
 * @param rs the ResultSet to set the fetch size for.
 * @param fetchSize the fetchSize.
 */
public static void setFetchSize(ResultSet rs, int fetchSize) {
  if (isFetchSizeSupported()) {
    try {
      rs.setFetchSize(fetchSize);
    }
    catch (Throwable t) {
      // Ignore. Exception may happen if the driver doesn't support
      // this operation and we didn't set meta-data correctly.
      // However, it is a good idea to update the meta-data so that
      // we don't have to incur the cost of catching an exception
      // each time.
      Log.error("Disabling JDBC method rs.setFetchSize(fetchSize).", t);
      fetchSizeSupported = false;
    }
  }
}

代码示例来源:origin: alibaba/druid

@Override
public void resultSet_setFetchSize(ResultSetProxy rs, int rows) throws SQLException {
  if (this.pos < filterSize) {
    nextFilter()
        .resultSet_setFetchSize(this, rs, rows);
    return;
  }
  rs.getResultSetRaw()
      .setFetchSize(rows);
}

代码示例来源:origin: oblac/jodd

rs = preparedStatement.executeQuery();
  rs.setFetchSize(fetchSize);
} catch (SQLException sex) {
  DbUtil.close(rs);

代码示例来源:origin: nutzam/nutz

rs.setFetchSize(Pager.DEFAULT_PAGE_SIZE);
else if (pager.getPageSize() > Pager.MAX_FETCH_SIZE)
  rs.setFetchSize(Pager.MAX_FETCH_SIZE);
else
  rs.setFetchSize(pager.getPageSize());

代码示例来源:origin: p6spy/p6spy

@Override
public void setFetchSize(int rows) throws SQLException {
 delegate.setFetchSize(rows);
}

代码示例来源:origin: Meituan-Dianping/Zebra

@Override
public void setFetchSize(int rows) throws SQLException {
  innerResultSet.setFetchSize(rows);
}

代码示例来源:origin: Meituan-Dianping/Zebra

@Override
public void setFetchSize(int rows) throws SQLException {
  innerResultSet.setFetchSize(rows);
}

代码示例来源:origin: apache/phoenix

@Override
public void setFetchSize(int rows) throws SQLException {
  rs.setFetchSize(rows);
}

代码示例来源:origin: com.alibaba/druid

@Override
public void setFetchSize(int rows) throws SQLException {
  try {
    rs.setFetchSize(rows);
  } catch (Throwable t) {
    throw checkException(t);
  }
}

代码示例来源:origin: palantir/atlasdb

@Override
public void setFetchSize(int fetchSize) {
  maxFetchSize = fetchSize;
  try {
    results.setFetchSize(fetchSize);
  } catch (SQLException e) {
    sqlExceptionlog.info("Caught SQLException", e); //$NON-NLS-1$
    log.error("Caught SQLException", e); //$NON-NLS-1$
    Throwables.rewrapAndThrowUncheckedException(e);
  }
}

代码示例来源:origin: palantir/atlasdb

private AgnosticIterator(){
  try{
    results.setFetchSize(INITIAL_FETCH_SIZE);
  } catch (SQLException e){
    sqlExceptionlog.info("Caught SQLException", e);
    log.error("Caught SQLException", e); //$NON-NLS-1$
    Throwables.rewrapAndThrowUncheckedException(e);
  }
}

代码示例来源:origin: schemacrawler/SchemaCrawler

try
 results.setFetchSize(FETCHSIZE);

代码示例来源:origin: palantir/atlasdb

private void advanceRow() {
  if (Thread.currentThread().isInterrupted()) {
    throw new PalantirInterruptedException("Interrupted while iterating through results."); //$NON-NLS-1$
  }
  try{
    numRowsFetchedSinceLastChange++;
    if (numRowsFetchedSinceLastChange >= results.getFetchSize()){
      results.setFetchSize(Math.min(results.getFetchSize() * 2, maxFetchSize));
      numRowsFetchedSinceLastChange = 0;
    }
  } catch (SQLException e){
    sqlExceptionlog.info("Caught SQLException", e);
    log.error("Caught SQLException", e); //$NON-NLS-1$
    Throwables.rewrapAndThrowUncheckedException(e);
  }
  try {
    hasNext = results.next();
  }
  catch(SQLException sqlex) {
    log.error("Caught SQLException", sqlex); //$NON-NLS-1$
    Throwables.rewrapAndThrowUncheckedException(sqlex);
  }
  hasReadRow = false;
}

代码示例来源:origin: com.alibaba/druid

@Override
public void resultSet_setFetchSize(ResultSetProxy rs, int rows) throws SQLException {
  if (this.pos < filterSize) {
    nextFilter()
        .resultSet_setFetchSize(this, rs, rows);
    return;
  }
  rs.getResultSetRaw()
      .setFetchSize(rows);
}

相关文章

微信公众号

最新文章

更多

ResultSet类方法