/** * True if current record is the first in the result set. * * @return True if current row is first * @throws QueryResultsException * if this result set has an exception * @throws InvalidatedResultsException * if the results were obtained during a transaction and the * transaction has been rolled back */ public boolean isFirst() throws SQLException { return this.getAbsoluteRowNumber() == BEFORE_FIRST_ROW + 1 && hasNext(); }
/** * True if current record is the first in the result set. * * @return True if current row is first * @throws QueryResultsException * if this result set has an exception * @throws InvalidatedResultsException * if the results were obtained during a transaction and the * transaction has been rolled back */ public boolean isFirst() throws SQLException { return this.getAbsoluteRowNumber() == BEFORE_FIRST_ROW + 1 && hasNext(); }
/** * <p> * Determines whether the cursor is before the first row in this ResultSet * object. This method should be called only if the result set is * scrollable. * </p> * * @return true if the cursor is before the last row in the resultSet;false * if the cursor is at any other position or the result set contains no * rows. * @throws SQLException */ public boolean isBeforeFirst() throws SQLException { // return true if there are rows and the current row is before first return getAbsoluteRowNumber() == BEFORE_FIRST_ROW && hasNext(); }
/** * <p> * Determines whether the cursor is before the first row in this ResultSet * object. This method should be called only if the result set is * scrollable. * </p> * * @return true if the cursor is before the last row in the resultSet;false * if the cursor is at any other position or the result set contains no * rows. * @throws SQLException */ public boolean isBeforeFirst() throws SQLException { // return true if there are rows and the current row is before first return getAbsoluteRowNumber() == BEFORE_FIRST_ROW && hasNext(); }
public boolean next() throws SQLException { checkClosed(); if (hasNext()) { return batchResults.next(); } batchResults.next(); return false; }
public boolean next() throws SQLException { checkClosed(); if (hasNext()) { return batchResults.next(); } batchResults.next(); return false; }
/** * True if current record is the last in the result set. * * @return True if current row is last * @throws QueryResultsException * if this result set has an exception * @throws InvalidatedResultsException * if the results were obtained during a transaction and the * transaction has been rolled back */ public boolean isLast() throws SQLException { return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() == getFinalRowNumber(); }
/** * True if current record is the last in the result set. * * @return True if current row is last * @throws QueryResultsException * if this result set has an exception * @throws InvalidatedResultsException * if the results were obtained during a transaction and the * transaction has been rolled back */ public boolean isLast() throws SQLException { return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() == getFinalRowNumber(); }
/** * <p> * Determines whether the cursor is after the last row in this ResultSet * object. This method should be called only if the result set is * scrollable. * </p> * * @return true if the cursor is after the last row in the resultSet. * @throws SQLException */ public boolean isAfterLast() throws SQLException { if (getFinalRowNumber() == -1) { return false; } // return true if the current row has a next row // it is also not the last return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() > getFinalRowNumber(); }
/** * <p> * Determines whether the cursor is after the last row in this ResultSet * object. This method should be called only if the result set is * scrollable. * </p> * * @return true if the cursor is after the last row in the resultSet. * @throws SQLException */ public boolean isAfterLast() throws SQLException { if (getFinalRowNumber() == -1) { return false; } // return true if the current row has a next row // it is also not the last return !hasNext() && this.getAbsoluteRowNumber() > BEFORE_FIRST_ROW && this.getAbsoluteRowNumber() > getFinalRowNumber(); }
/** test hasNext() without walking through any row */ @Test public void testHasNext1() throws SQLException { ResultSetImpl cs = helpExecuteQuery(); assertEquals(" hasNext() doesn't match expected value. ", true, cs.hasNext()); //$NON-NLS-1$ cs.close(); }
/** test hasNext() with blocking for the Next batch -- triggering point */ @Test public void testHasNext2() throws SQLException { ResultSetImpl cs = helpExecuteQuery(); cs.absolute(100); assertEquals(" hasNext() doesn't match expected value. ", true, cs.hasNext()); //$NON-NLS-1$ cs.close(); }
/** at the end of all batches */ @Test public void testHasNext4() throws SQLException { ResultSetImpl cs = helpExecuteQuery(); cs.absolute(1000); assertTrue(!cs.hasNext()); cs.close(); }
/** test hasNext() with nextBatch!=null -- short response */ @Test public void testHasNext3() throws SQLException { ResultSetImpl cs = helpExecuteQuery(); int i = 0; while (cs.next()) { if (i == 289) { break; } i++; } assertEquals(" hasNext() doesn't match expected value. ", true, cs.hasNext()); //$NON-NLS-1$ cs.close(); }
/** test next(), when hasNext() == false */ @Test public void testNext5() throws Exception { ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(), statement); while (rs.next()) { // just walk through until hasNext() == false; } boolean actual = rs.hasNext(); boolean expected = false; assertEquals(expected, actual); rs.close(); }
/** test hasNext(), actual result set should return FALSE. */ @Test public void testHasNext1() throws Exception { ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(), statement); while (rs.next()) { // just walk through } boolean actual = rs.hasNext(); boolean expected = false; assertEquals(expected, actual); rs.close(); }
/** test hasNext(), actual result set should return TRUE. */ @Test public void testHasNext2() throws Exception { List[] results = exampleResults1(5); ResultSetImpl rs = new ResultSetImpl(exampleResultsMsg1(), statement); for (int i = 1; i < results.length; i++) { rs.next(); } boolean actual = rs.hasNext(); boolean expected = true; assertEquals(expected, actual); rs.close(); }