Package java.sql

Examples of java.sql.ResultSet.deleteRow()


       
        // position the result set on the next row
        assertTrue("FAIL - row not found", rs.next());
        // calling delete row not will not fail because the result set is
        // positioned
        rs.deleteRow();
        rs.close();
       
        // verify that the table contains one row
        String[][] expected = {{"3", "cc"}};
        JDBC.assertFullResultSet(
View Full Code Here


       
        rs = stmt.executeQuery("SELECT 1, 2 FROM t1 FOR UPDATE");
        assertTrue("FAIL - row not found", rs.next());
        assertEquals("FAIL - wrong value for column 1", 1, rs.getInt(1));
        try {
            rs.deleteRow();
            assertTrue("FAIL - should have failed in network server",
                    usingEmbedded());
        } catch (SQLException e) {
            assertTrue("FAIL - should not fail on embedded", !usingEmbedded());
            assertSQLState("42X01", e);
View Full Code Here

                ResultSet.CONCUR_UPDATABLE, pStmt.getResultSetConcurrency());
        pStmt.setInt(1,0);
        ResultSet rs = pStmt.executeQuery();
        assertTrue("FAIL - statement should return a row", rs.next());
        int c1Before = rs.getInt(1);
        rs.deleteRow();
       
        // Since after deleteRow(), ResultSet is positioned before the next
        // row, getXXX will fail
        try {
            rs.getInt(1);
View Full Code Here

        }
       
        // calling deleteRow again w/o first positioning the ResultSet on the
        // next row will fail
        try {
            rs.deleteRow();
            fail("FAIL - deleteRow should have failed because it can't be " +
                    "called more than once on the same row");
        } catch (SQLException e) {
            String sqlState = "24000";
            assertSQLState(sqlState, e);
View Full Code Here

        assertTrue("FAIL - statement should return a row", rs.next());
        //Derby-718 check that column values are not null after next()
        assertFalse("FAIL - first column should not be 0", rs.getInt(1) == 0);
        // Derby-718
        // Should be able to deletRow() on the current row now
        rs.deleteRow();
       
        rs.close();
        pStmt.close();
       
        // Verify that the data was correctly updated
View Full Code Here

                ResultSet.TYPE_FORWARD_ONLY, callStmt.getResultSetType());
        assertEquals("FAIL - wrong result set concurrency",
                ResultSet.CONCUR_UPDATABLE, callStmt.getResultSetConcurrency());
        assertTrue("FAIL - statement should return a row", rs.next());
        assertEquals("FAIL - wrong value for column 1", 1, rs.getInt(1));
        rs.deleteRow();
       
        // Since after deleteRow(), ResultSet is positioned before the next row,
        // getXXX will fail
        try {
            rs.getInt(1);
View Full Code Here

        }
       
        // calling deleteRow again w/o first positioning the ResultSet on the
        // next row will fail
        try {
            rs.deleteRow();
            fail("FAIL - deleteRow should have failed because it can't be " +
                    "called more than once on the same row");
        } catch (SQLException e) {
            String sqlState = "24000";
            assertSQLState(sqlState, e);
View Full Code Here

        }
       
        // Position the ResultSet with next()
        assertTrue("FAIL - statement should return a row", rs.next());
        // Should be able to deletRow() on the current row now
        rs.deleteRow();
        //have to close the resultset because by default, resultsets are held
        // open over commit
        rs.close();
        callStmt.close();
       
View Full Code Here

            rs.updateInt(2,42);
            rs.insertRow();

            // Delete a row
            rs.previous();
            rs.deleteRow();

            // .. and see that a hole is left in its place
            rs.previous();
            rs.next();
            assertTrue(rs.rowDeleted());
View Full Code Here

        rs = stmt.executeQuery("SELECT * FROM selfReferencingT1");
        assertTrue("FAIL - row not found", rs.next());
        assertEquals("FAIL - wrong value for column1", "e1", rs.getString(1));
        // this delete row will cause the delete cascade constraint to delete
        // all the rows from the table and from the resultset
        rs.deleteRow();
        assertFalse("FAIL - row not found", rs.next());
        try {     
            rs.deleteRow();
            fail("FAIL - there should have be no more rows in the resultset " +
                    "at this point because of the delete cascade");
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.