Package java.sql

Examples of java.sql.ResultSet.updateInt()


        assertTrue("Expected rs.rowUpdated() to be true after updateRow",
                   rs.rowUpdated());
        assertEquals("Expected the resultset detect the updates of previous " +
                     "updateRow", newCol2, rs.getInt(2));
       
        rs.updateInt(3, newCol3);
       
        assertEquals("Expected the resultset to be updated after updateInt",
                     newCol3, rs.getInt(3));
        assertEquals("Expected the resultset detect the updates of previous " +
                     "updateRow", newCol2, rs.getInt(2));
View Full Code Here


        // 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();
        assertEquals("CurrentPosition should be " + currentPosition,
                rs.getRow(), currentPosition);
View Full Code Here

                rs.getRow(), currentPosition);

       
        try {
            rs.moveToInsertRow();
            rs.updateInt(1, currentPosition + 2000);
            rs.updateRow();
        } catch (SQLException se) {
            assertEquals("Expected exception",
                    se.getSQLState().substring(0, 5),
                    INVALID_CURSOR_STATE_NO_CURRENT_ROW);
View Full Code Here

                    INVALID_CURSOR_STATE_NO_CURRENT_ROW);
        }
       
        try {
            rs.moveToInsertRow();
            rs.updateInt(1, currentPosition + 2000);
            rs.deleteRow();
        } catch (SQLException se) {
            assertEquals("Expected exception",
                    se.getSQLState().substring(0, 5),
                    INVALID_CURSOR_STATE_NO_CURRENT_ROW);
View Full Code Here

                    INVALID_CURSOR_STATE_NO_CURRENT_ROW);
        }
       
        try {
            rs.moveToCurrentRow();
            rs.updateInt(1, currentPosition + 2000);
            rs.insertRow();
        } catch (SQLException se) {
            assertEquals("Expected exception",
                    se.getSQLState().substring(0, 5),
                    CURSOR_NOT_POSITIONED_ON_INSERT_ROW);
View Full Code Here

        while(rs.previous()) {
            // Update the key of every second row.
            int key = rs.getInt(1);
            if (key%2==0) {
                int newKey = -key;
                rs.updateInt(1, newKey);
                rs.updateRow();
            }
        }
        PreparedStatement ps = prepareStatement
            ("select * from t1 where id=?");
View Full Code Here

        ps.setInt(1, -primaryKey);
        ps.setInt(2, primaryKey);
        assertEquals("Expected one row to be updated", 1,
                     ps.executeUpdate());
       
        rs.updateInt(2, -555);
        rs.updateInt(3, -777);
        rs.updateRow();
       
        PreparedStatement ps2 = prepareStatement
            ("select * from t1 where id=?");
View Full Code Here

        ps.setInt(2, primaryKey);
        assertEquals("Expected one row to be updated", 1,
                     ps.executeUpdate());
       
        rs.updateInt(2, -555);
        rs.updateInt(3, -777);
        rs.updateRow();
       
        PreparedStatement ps2 = prepareStatement
            ("select * from t1 where id=?");
        ps2.setInt(1, -primaryKey);
View Full Code Here

            ("update t1 set id = ? where id= ?");
        ps.setInt(1, -primaryKey);
        ps.setInt(2, primaryKey);
        assertEquals("Expected one row to be updated", 1,
                     ps.executeUpdate());
        rs.updateInt(1, primaryKey*10);
        rs.updateInt(2, -555);
        rs.updateInt(3, -777);
        rs.updateRow();
       
        PreparedStatement ps2 =
View Full Code Here

        ps.setInt(1, -primaryKey);
        ps.setInt(2, primaryKey);
        assertEquals("Expected one row to be updated", 1,
                     ps.executeUpdate());
        rs.updateInt(1, primaryKey*10);
        rs.updateInt(2, -555);
        rs.updateInt(3, -777);
        rs.updateRow();
       
        PreparedStatement ps2 =
            prepareStatement("select * from t1 where id=?");
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.