public int readNextToTarget ( int iTargetPosition , int iRelPosition ) throws DBException { int iRecordStatus = DBConstants . RECORD_NORMAL ; boolean bMore = true ; ResultSet resultSet = ( ResultSet ) this . getResultSet ( ) ; while ( m_iRow < iTargetPosition ) { // Spin until you get to the row or hit EOF try { bMore = resultSet . next ( ) ; if ( ! bMore ) { m_iEOFRow = m_iRow ; // Last physical row = this row - 1. break ; // Hit EOF } m_iRow ++ ; // Current row } catch ( SQLException e ) { DBException dbEx = this . getDatabase ( ) . convertError ( e ) ; int iErrorCode = dbEx . getErrorCode ( ) ; if ( ( iRelPosition == DBConstants . FIRST_RECORD ) || ( ( iRelPosition == DBConstants . LAST_RECORD ) ) ) if ( iErrorCode == DBConstants . INVALID_RECORD ) return ( DBConstants . RECORD_INVALID | DBConstants . RECORD_AT_BOF | DBConstants . RECORD_AT_EOF ) ; // Move first - no records throw dbEx ; } } if ( ( m_iRow == - 1 ) || ( iTargetPosition == - 1 ) ) iRecordStatus |= DBConstants . RECORD_INVALID | DBConstants . RECORD_AT_BOF ; if ( ! bMore ) { iRecordStatus |= DBConstants . RECORD_AT_EOF ; int iEOFRow = m_iEOFRow ; // Save for a sec this . setResultSet ( null , DBConstants . SQL_SELECT_TYPE ) ; // Can't use anymore m_iEOFRow = iEOFRow ; // I do know the EOF } return iRecordStatus ; }
Read next until you get to this position .