Package java.sql

Examples of java.sql.ResultSet.deleteRow()


        ResultSet rs = s.executeQuery("select a,b from t1");
        rs.next();
        rs.updateInt(1, rs.getInt(1) + 2 * recordCount);
        rs.updateRow();
        assertTrue("Expected rowUpdated() to return true", rs.rowUpdated());
        rs.deleteRow();
        rs.next();
        rs.previous();
        assertTrue("Expected rowUpdated() to return true", rs.rowUpdated());
        assertTrue("Expected rowDeleted() to return true", rs.rowDeleted());
        rs.next();
View Full Code Here


        rs.afterLast();
        checkDetectabilityCallsOutsideRow(rs, "on afterLast row");

        rs.first();
        rs.deleteRow();
        checkDetectabilityCallsOutsideRow(rs, "after deleteRow");

        rs.last();
        rs.deleteRow();
        checkDetectabilityCallsOutsideRow(rs, "after deleteRow of last row");
View Full Code Here

        rs.first();
        rs.deleteRow();
        checkDetectabilityCallsOutsideRow(rs, "after deleteRow");

        rs.last();
        rs.deleteRow();
        checkDetectabilityCallsOutsideRow(rs, "after deleteRow of last row");

        rs.close();
        s.close();
View Full Code Here

        rs.updateInt(2, 666);
        rs.updateRow();
        checkDetectabilityCallsOutsideRow(rs, "after FO updateRow");

        rs.next();
        rs.deleteRow();
        checkDetectabilityCallsOutsideRow(rs, "after FO deleteRow");

        while (rs.next()) {};
        checkDetectabilityCallsOutsideRow(rs, "after FO emptied out");
View Full Code Here

        createTableT1();
        Statement stmt = createStatement(
                ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
        ResultSet rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
        assertTrue("FAIL - row not found", rs.next());
        rs.deleteRow();
        // getXXX right after deleteRow will fail because resultset is not
        // positioned on a row, instead it is right before the next row
        try {
            rs.getString(1);
            fail("FAIL - getString should have failed, result set not " +
View Full Code Here

        assertTrue("FAIL - row not found", rs.next());
        rs.close();
       
        // attempt to send a deleteRow on a closed result set
        try {
            rs.deleteRow();
            fail("FAIL - deleteRow should have failed because this " +
                    "result set is closed");
        } catch (SQLException e) {
            assertSQLState("XCL16", e);
            // DERBY-4767, sample verification test for operation in XCL16 message.
View Full Code Here

            String sqlState = usingEmbedded()? "XCL16" : "24000";
            assertSQLState(sqlState, e);
        }
       
        try {
            rs.deleteRow();
            fail("FAIL - resultset should have been closed at this point and " +
                    "deleteRow should have failed");
        } catch (SQLException e) {
            String sqlState = usingEmbedded()? "XCL16" : "24000";
            assertSQLState(sqlState, e);
View Full Code Here

                ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
        ResultSet rs = stmt.executeQuery(
                "SELECT * FROM tableWithPrimaryKey FOR UPDATE");
        assertTrue("FAIL - row not found", rs.next());
        try {
            rs.deleteRow();
            fail("FAIL - deleteRow should have failed because it will cause " +
                    "foreign key constraint failure");
        } catch (SQLException e) {
            assertSQLState("23503", e);
        }
View Full Code Here

       
        ResultSet rs = stmt.executeQuery("SELECT * FROM t1");
        assertTrue("FAIL - row not found", rs.next());
        int c1Before = rs.getInt(1);
        String c2Before = rs.getString(2);
        rs.deleteRow();
        // Calling getXXX will fail because the result set is positioned before
        //the next row.
        try {
            rs.getInt(1);
            fail("FAIL - result set not positioned on a row, rs.getInt(1) " +
View Full Code Here

        }
       
        // Calling deleteRow again again w/o first positioning the ResultSet on
        // the next row will fail
        try {
            rs.deleteRow();
            fail("FAIL - deleteRow should have failed because ResultSet is " +
                    "not positioned on a row");
        } catch (SQLException e) {
            assertSQLState("24000", e);
        }
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.