Example usage for java.sql ResultSet absolute

List of usage examples for java.sql ResultSet absolute

Introduction

In this page you can find the example usage for java.sql ResultSet absolute.

Prototype

boolean absolute(int row) throws SQLException;

Source Link

Document

Moves the cursor to the given row number in this ResultSet object.

Usage

From source file:org.pentaho.di.core.database.Database.java

public boolean absolute(ResultSet rs, int position) throws KettleDatabaseException {
    try {//  w  w  w.j  av  a2s.  co m
        return rs.absolute(position);
    } catch (SQLException e) {
        throw new KettleDatabaseException("Unable to move resultset to position " + position, e);
    }
}

From source file:pub.platform.db.DatabaseConnection.java

/**
 * Description of the Method//from w w  w  .  j av a 2  s.  c  o m
 * 
 * @param pst
 *          Description of the Parameter
 * @param beginIndex
 *          Description of the Parameter
 * @param resultNo
 *          Description of the Parameter
 * @return Description of the Return Value
 */
public RecordSet executeQuery(PreparedStatement pst, int beginIndex, int resultNo) {
    if (pst == null) {
        System.out.println("DatabaseConnection.executeQuery's pst parameter is null!!!");
        return new RecordSet();
    }

    try {

        pst.setMaxRows(beginIndex - 1 + resultNo);

        ResultSet rs = pst.executeQuery();
        if (beginIndex != 1) {
            rs.absolute(beginIndex - 1);
        }

        RecordSet records = new RecordSet(rs, resultNo);

        rs.close();
        pst.close();
        return records;
    } catch (SQLException sqle) {
        errorException = sqle;
        logger.error("", sqle);
        return new RecordSet();
    }
}