Package java.sql

Examples of java.sql.ResultSet.previous()


        assertNotNull(rs);

        rs.afterLast();
        // Iterate backwards thru RS, expect only 5 rows.
        for (int index = 1; index < 6; index++) {
            assertTrue(rs.previous());

        }
        // We should not see another row (only 5, not 6)
        assertFalse(rs.previous());
        rs.close();
View Full Code Here


        for (int index = 1; index < 6; index++) {
            assertTrue(rs.previous());

        }
        // We should not see another row (only 5, not 6)
        assertFalse(rs.previous());
        rs.close();
        // Verify setting maxRows back to 0 works.
        s_i_r.setMaxRows(0);
        rs = s_i_r.executeQuery("values 1, 2, 3, 4, 5, 6");
        assertNotNull(rs);
View Full Code Here

        rs = s_i_r.executeQuery("select * from t where 1=0");
        // isBeforeFirst() and isAfterLast() should always return false
        // when result set is empty
        assertFalse(rs.isBeforeFirst());
        assertFalse(rs.next());
        assertFalse(rs.previous());
        assertFalse(rs.isAfterLast());
        assertFalse(rs.isFirst());
        assertFalse(rs.isLast());
        assertFalse(rs.relative(0));
        assertFalse(rs.relative(1));
View Full Code Here

        // Start from afterLast and verify maxRows
        rs.afterLast();
        // Iterate backwards thru RS, expect only (maxRows - 1) rows.
        for (int index = 1; index < maxRows + 1; index++) {
            assertTrue(rs.previous());
            assertEquals(maxRows - index + 1, rs.getInt(1));
        }
        // We should not see another row (only maxRows, not total)
        assertFalse(rs.previous());
View Full Code Here

        for (int index = 1; index < maxRows + 1; index++) {
            assertTrue(rs.previous());
            assertEquals(maxRows - index + 1, rs.getInt(1));
        }
        // We should not see another row (only maxRows, not total)
        assertFalse(rs.previous());

        // Start from last and verify maxRows
        assertTrue(rs.last());

        // Iterate backwards thru RS, expect only (maxRows - 1) more rows.
View Full Code Here

        // Start from last and verify maxRows
        assertTrue(rs.last());

        // Iterate backwards thru RS, expect only (maxRows - 1) more rows.
        for (int index = 1; index < maxRows; index++) {
            assertTrue(rs.previous());
            assertEquals((maxRows - index), rs.getInt(1));

        }
        // We should not see another row (only 5, not 6)
        assertFalse(rs.previous());
View Full Code Here

            assertTrue(rs.previous());
            assertEquals((maxRows - index), rs.getInt(1));

        }
        // We should not see another row (only 5, not 6)
        assertFalse(rs.previous());
        rs.last();
        int rows = rs.getRow();

        rs.absolute(rows / 2);
        assertFalse(rs.relative(-1 * (rows)));
 
View Full Code Here

            rs.last();
            assertEquals("m",rs.getString(1).trim());
            assertEquals(13, rs.getInt(2));
            assertEquals(12, rs.getRow());
           
            rs.previous();
            assertEquals("l",rs.getString(1).trim());
            assertEquals(12, rs.getInt(2));
            assertEquals(11, rs.getRow());
           
            rs.first();
View Full Code Here

            rs.first();
            assertEquals("b", rs.getString(1).trim());
            assertEquals(2, rs.getInt(2));
            assertEquals(1, rs.getRow());

            rs.previous();
            assertNoCurrentRow(rs);
            rs.next();
            assertEquals("b", rs.getString(1).trim());
            assertEquals(2, rs.getInt(2));
            assertEquals(1, rs.getRow());
View Full Code Here

           
            // afterLast first
            rs = ps_c1.executeQuery();
            rs.afterLast();
            assertNoCurrentRow(rs);
            rs.previous();
           
            assertEquals("m",rs.getString(1).trim());
            assertEquals(13, rs.getInt(2));
            assertEquals(12, rs.getRow());
           
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.