Package java.sql

Examples of java.sql.ResultSet.absolute()


        assertTrue(rs.isBeforeFirst());

        rs.absolute(rows / 2);
        assertFalse(rs.relative(rows));
        assertTrue(rs.isAfterLast());
        rs.absolute(rows / 2);
        assertFalse("absolute(" + (rows + 1)
                + ") should return false, position outside of the resultSet",
                rs.absolute(rows + 1));

        rs.absolute(rows / 2);
View Full Code Here


        assertFalse(rs.relative(rows));
        assertTrue(rs.isAfterLast());
        rs.absolute(rows / 2);
        assertFalse("absolute(" + (rows + 1)
                + ") should return false, position outside of the resultSet",
                rs.absolute(rows + 1));

        rs.absolute(rows / 2);
        assertFalse(rs.absolute((-1) * (rows + 1)));

        assertTrue(rs.isBeforeFirst());
View Full Code Here

        rs.absolute(rows / 2);
        assertFalse("absolute(" + (rows + 1)
                + ") should return false, position outside of the resultSet",
                rs.absolute(rows + 1));

        rs.absolute(rows / 2);
        assertFalse(rs.absolute((-1) * (rows + 1)));

        assertTrue(rs.isBeforeFirst());

        rs.close();
View Full Code Here

        assertFalse("absolute(" + (rows + 1)
                + ") should return false, position outside of the resultSet",
                rs.absolute(rows + 1));

        rs.absolute(rows / 2);
        assertFalse(rs.absolute((-1) * (rows + 1)));

        assertTrue(rs.isBeforeFirst());

        rs.close();

View Full Code Here

            assertOnlyOnScrollableException(sqle);

        }
        try {
            rs.absolute(1);
            // Should never get here
            fail("absolute() expected to fail");
        } catch (SQLException sqle) {
            assertOnlyOnScrollableException(sqle);
View Full Code Here

        // verify scroll insensitive and read only
        assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
        assertEquals(ResultSet.CONCUR_READ_ONLY, rs.getConcurrency());
        // We should be positioned before the 1st row
        assertTrue(rs.isBeforeFirst());
        assertFalse(rs.absolute(0));
        // still expected to be before first
        assertTrue(rs.isBeforeFirst());
        // go to first row
        assertTrue(rs.first());
        assertEquals(rs.getInt(1), 2);
View Full Code Here

        ResultSet rs = null;
        try {
            s = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            s.setFetchSize(toIndex - fromIndex);
            rs = s.executeQuery(statements.getFindAllIdsStatement());
            rs.absolute(fromIndex + 1);
            String[] ids = new String[toIndex - fromIndex];
            for (int row = 0; row < toIndex - fromIndex; row++) {
                ids[row] = rs.getString(1);
                if (!rs.next()) {
                    break;
View Full Code Here

            ps_c1.close();
            // use absolute to get rows before scan would get to them.
           ps_c1 = conn.prepareStatement("select i from t1", ResultSet.TYPE_SCROLL_INSENSITIVE,
                   ResultSet.CONCUR_READ_ONLY);
           rs = ps_c1.executeQuery();
           rs.absolute(5);
           assertEquals(6, rs.getInt(1));
           assertEquals(5, rs.getRow());
          
           rs.absolute(-5);
           assertEquals(9,rs.getInt(1));
View Full Code Here

           rs = ps_c1.executeQuery();
           rs.absolute(5);
           assertEquals(6, rs.getInt(1));
           assertEquals(5, rs.getRow());
          
           rs.absolute(-5);
           assertEquals(9,rs.getInt(1));
           assertEquals(8, rs.getRow());

           rs.absolute(5);
           assertEquals(6,rs.getInt(1));
View Full Code Here

          
           rs.absolute(-5);
           assertEquals(9,rs.getInt(1));
           assertEquals(8, rs.getRow());

           rs.absolute(5);
           assertEquals(6,rs.getInt(1));
           assertEquals(5, rs.getRow());
           rs.close();
           rs = ps_c1.executeQuery();
           rs.absolute(13);
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.