本文整理了Java中java.sql.ResultSet.absolute
方法的一些代码示例,展示了ResultSet.absolute
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.absolute
方法的具体详情如下:
包路径:java.sql.ResultSet
类名称:ResultSet
方法名:absolute
[英]Moves the cursor to a specified row number in the ResultSet.
[中]将光标移动到结果集中的指定行号。
代码示例来源:origin: apache/groovy
private static boolean moveCursor(ResultSet results, int offset) throws SQLException {
boolean cursorAtRow = true;
if (results.getType() == ResultSet.TYPE_FORWARD_ONLY) {
int i = 1;
while (i++ < offset && cursorAtRow) {
cursorAtRow = results.next();
}
} else if (offset > 1) {
cursorAtRow = results.absolute(offset - 1);
}
return cursorAtRow;
}
代码示例来源:origin: querydsl/querydsl
@Override
public boolean absolute(int row) throws SQLException {
return rs.absolute(row);
}
代码示例来源:origin: codingapi/tx-lcn
@Override
public boolean absolute(int row) throws SQLException {
return delegate.absolute(row);
}
代码示例来源:origin: spring-projects/spring-framework
/**
* @see java.sql.ResultSet#absolute(int)
*/
@Override
public boolean absolute(int row) throws InvalidResultSetAccessException {
try {
return this.resultSet.absolute(row);
}
catch (SQLException se) {
throw new InvalidResultSetAccessException(se);
}
}
代码示例来源:origin: alibaba/druid
@Override
public boolean absolute(int row) throws SQLException {
try {
return rs.absolute(row);
} catch (Throwable t) {
throw checkException(t);
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public boolean absolute( ResultSet rs, int position ) throws KettleDatabaseException {
try {
return rs.absolute( position );
} catch ( SQLException e ) {
throw new KettleDatabaseException( "Unable to move resultset to position " + position, e );
}
}
代码示例来源:origin: spotbugs/spotbugs
@NoWarning("SQL_BAD_RESULTSET_ACCESS")
void notBug3(ResultSet any) throws SQLException {
any.absolute(0);
}
代码示例来源:origin: alibaba/druid
@Override
public boolean resultSet_absolute(ResultSetProxy rs, int row) throws SQLException {
if (this.pos < filterSize) {
return nextFilter()
.resultSet_absolute(this, rs, row);
}
return rs.getResultSetRaw()
.absolute(row);
}
代码示例来源:origin: requery/requery
@Override
public E get(int index) {
if (index < 0) {
throw new IndexOutOfBoundsException();
}
try {
// if the result set type is TYPE_FORWARD_ONLY, this will throw
if (results.absolute(index + 1)) {
position = index;
if (results.rowDeleted()) {
return null;
}
return reader.read(results, selection);
} else {
throw new UnsupportedOperationException();
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: spring-projects/spring-batch
/**
* Use {@link ResultSet#absolute(int)} if possible, otherwise scroll by
* calling {@link ResultSet#next()}.
*/
@Override
protected void jumpToItem(int itemIndex) throws Exception {
if (driverSupportsAbsolute) {
try {
rs.absolute(itemIndex);
}
catch (SQLException e) {
// Driver does not support rs.absolute(int) revert to
// traversing ResultSet
log.warn("The JDBC driver does not appear to support ResultSet.absolute(). Consider"
+ " reverting to the default behavior setting the driverSupportsAbsolute to false", e);
moveCursorToRow(itemIndex);
}
}
else {
moveCursorToRow(itemIndex);
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public boolean setRowNumber(int rowNumber) throws HibernateException {
if ( rowNumber >= 0 ) {
rowNumber++;
}
try {
final boolean result = getResultSet().absolute( rowNumber );
prepareCurrentRow( result );
return result;
}
catch (SQLException sqle) {
throw convert( sqle, "could not advance using absolute()" );
}
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Advance the cursor to the first required row of the <tt>ResultSet</tt>
*/
private void advance(final ResultSet rs, final RowSelection selection) throws SQLException {
final int firstRow = LimitHelper.getFirstRow( selection );
if ( firstRow != 0 ) {
if ( getFactory().getSessionFactoryOptions().isScrollableResultSetsEnabled() ) {
// we can go straight to the first required row
rs.absolute( firstRow );
}
else {
// we need to step through the rows one row at a time (slow)
for ( int m = 0; m < firstRow; m++ ) {
rs.next();
}
}
}
}
代码示例来源:origin: hibernate/hibernate-orm
/**
* Advance the cursor to the first required row of the <tt>ResultSet</tt>
*/
protected void advance(final ResultSet rs, final RowSelection selection) throws SQLException {
final int firstRow = LimitHelper.getFirstRow( selection );
if ( firstRow != 0 ) {
if ( getFactory().getSettings().isScrollableResultSetsEnabled() ) {
// we can go straight to the first required row
rs.absolute( firstRow );
}
else {
// we need to step through the rows one row at a time (slow)
for ( int m = 0; m < firstRow; m++ ) {
rs.next();
}
}
}
}
代码示例来源:origin: com.h2database/h2
rs.moveToInsertRow();
} else {
rs.absolute(row);
rs.absolute(row);
rs.deleteRow();
} else if (op == 3) {
代码示例来源:origin: p6spy/p6spy
@Override
public boolean absolute(int row) throws SQLException {
return delegate.absolute(row);
}
代码示例来源:origin: nutzam/nutz
if (rs.absolute(ls.start + 1))
for (int i = ls.start; i < ls.max; i++) {
createObject(++index, rs, context, rowCount);
代码示例来源:origin: nutzam/nutz
rs.absolute(startRow);
代码示例来源:origin: com.alibaba/druid
@Override
public boolean absolute(int row) throws SQLException {
try {
return rs.absolute(row);
} catch (Throwable t) {
throw checkException(t);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
private void skipRows(ResultSet rs, RowBounds rowBounds) throws SQLException {
if (rs.getType() != ResultSet.TYPE_FORWARD_ONLY) {
if (rowBounds.getOffset() != RowBounds.NO_ROW_OFFSET) {
rs.absolute(rowBounds.getOffset());
}
} else {
for (int i = 0; i < rowBounds.getOffset(); i++) {
rs.next();
}
}
}
代码示例来源:origin: com.alibaba/druid
@Override
public boolean resultSet_absolute(ResultSetProxy rs, int row) throws SQLException {
if (this.pos < filterSize) {
return nextFilter()
.resultSet_absolute(this, rs, row);
}
return rs.getResultSetRaw()
.absolute(row);
}
内容来源于网络,如有侵权,请联系作者删除!