Package java.sql

Examples of java.sql.ResultSet.previous()


            ResultSet srs = statement.executeQuery("select * from t1 limit 2");

            srs.afterLast();

            while (srs.previous()) {
                String name = srs.getString(2);
                float  id   = srs.getFloat(1);

                System.out.println(name + "   " + id);
            }
View Full Code Here


            srs = statement.executeQuery("select * from t1 limit 2");

            srs.absolute(3);

            while (srs.previous()) {
                String name = srs.getString(2);
                float  id   = srs.getFloat(1);

                System.out.println(name + "   " + id);
            }
View Full Code Here

                System.out.println(name + "   " + id);
            }

            srs.absolute(2);

            while (srs.previous()) {
                String name = srs.getString(2);
                float  id   = srs.getFloat(1);

                System.out.println(name + "   " + id);
            }
View Full Code Here

                System.out.println(name + "   " + id);
            }

            srs.absolute(-1);

            while (srs.previous()) {
                String name = srs.getString(2);
                float  id   = srs.getFloat(1);

                System.out.println(name + "   " + id);
            }
View Full Code Here

        // Test that it is possible to move to previous row from insertRow
        currentPosition = rs.getRow();
        rs.moveToInsertRow();
        rs.updateInt(1, currentPosition + 1000);
        rs.previous();
        assertEquals("CurrentPosition should be " + (currentPosition - 1),
                rs.getRow(), currentPosition - 1);
        // should be able to delete the row
        rs.deleteRow();
View Full Code Here

                QUERY_NOT_QUALIFIED_FOR_UPDATABLE_RESULTSET);
       
        // call positioning methods
        rs.next();
        rs.next();
        rs.previous();
        rs.relative(1);
        rs.absolute(3);
        rs.relative(-1);
        rs.first();
        rs.last();
View Full Code Here

        currentPosition = rs.getRow();
        rs.moveToInsertRow();
        rs.updateInt(1, currentPosition + 1000);
        rs.afterLast();
        assertTrue("isAfterLast() should return true", rs.isAfterLast());
        rs.previous();
        assertEquals("CurrentPosition should be " + lastRow,
                rs.getRow(), lastRow);
        assertTrue("isLast() should return true", rs.isLast());

        // Test that it is possible to insert a row and move back to current row
View Full Code Here

        assertEquals("CurrentPosition should be " + lastRow,
                rs.getRow(), lastRow);
        assertTrue("isLast() should return true", rs.isLast());

        // Test that it is possible to insert a row and move back to current row
        rs.previous();
        currentPosition = rs.getRow();
        rs.moveToInsertRow();
        rs.updateInt(1, currentPosition + 1000);
        rs.insertRow();
        rs.moveToCurrentRow();
View Full Code Here

        ResultSet rs =
            s.executeQuery("select * from t1 where a=1 or a=2");
       
        rs.next();
        rs.next();
        rs.previous();
        verifyTuple(rs);
        updateTuple(rs);
        s.close();
    }
   
View Full Code Here

        ResultSet rs = s.executeQuery
            ("select * from t1 where a=1 or a=2 for update");
       
        rs.next();
        rs.next();
        rs.previous();
        verifyTuple(rs);
        updateTuple(rs);
        rs.close();
        s.close();
    }
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.