Package java.sql

Examples of java.sql.ResultSet.updateString()


                ResultSet.CONCUR_UPDATABLE);
        ResultSet rs = s.executeQuery(SELECT_STMT);
        rs.next();

        for (int i = 1; i <= COLUMNS; i++) {
            rs.updateString(i, "2");
            assertEquals("Expected rs.getDouble(" + i +
                         ") to match updated value", 2, (int) rs.getDouble(i));
        }
        rs.updateRow();
        rs.close();
View Full Code Here


        assertTrue(rs.isBeforeFirst());
        rs.moveToInsertRow();
        rs.updateInt("EMPLOYEEID", 666);
        rs.updateInt("CATEGORY", 667);
        rs.updateDouble("SALARY", 666.0);
        rs.updateString("NAME", "N.N.");
        rs.insertRow();
        rs.close();

        rs = cStmt.executeQuery(
            "select * from s1.wages where name = 'N.N.'");
View Full Code Here

        // case a)
        ResultSet rs = s.executeQuery("select c from t1 for update of c");

        rs.next();
        rs.updateString(1,"foobar");
        rs.updateRow();
        rs.next();
        rs.previous();
        assertEquals("foobar", rs.getString(1));
        rs.close();
View Full Code Here

        rs = s.executeQuery("SELECT * from t1 for update of c");
        rs.next();
        int id = rs.getInt(1);
        int a =  rs.getInt(2);
        int b =  rs.getInt(3);
        rs.updateString(4,"foobar");
        rs.updateRow();
        rs.next();
        rs.previous();
        assertEquals(id, rs.getInt(1));
        assertEquals(a, rs.getInt(2));
View Full Code Here

        rs = s.executeQuery("SELECT * from t1 for update of id,a,b,c");
        rs.next();
        rs.updateInt(1, -20);
        rs.updateInt(2, 20);
        rs.updateInt(3, 21);
        rs.updateString(4,"foobar");
        rs.updateRow();
        rs.next();
        rs.previous();
        assertEquals(-20, rs.getInt(1));
        assertEquals(20, rs.getInt(2));
View Full Code Here

                        rs.updateDouble(ColumnNames[sqlType-1],
                                rs1.getDouble(updateXXXName));
                } else if (updateXXXName == 7) {
                    //update column with updateString methods
                    if (indexOrName == 1) //test by passing column position
                        rs.updateString(sqlType, rs1.getString(updateXXXName));
                    else //test by passing column name
                        rs.updateString(ColumnNames[sqlType-1],
                                rs1.getString(updateXXXName));
                } else if (updateXXXName == 8) {
                    //update column with updateAsciiStream methods
View Full Code Here

                } else if (updateXXXName == 7) {
                    //update column with updateString methods
                    if (indexOrName == 1) //test by passing column position
                        rs.updateString(sqlType, rs1.getString(updateXXXName));
                    else //test by passing column name
                        rs.updateString(ColumnNames[sqlType-1],
                                rs1.getString(updateXXXName));
                } else if (updateXXXName == 8) {
                    //update column with updateAsciiStream methods
                    if (indexOrName == 1) //test by passing column position
                        rs.updateAsciiStream(sqlType,
View Full Code Here

        }
       
        // Position the ResultSet with next()
        assertTrue("FAIL - row not found", rs.next());
        //Should be able to updateRow() on the current row now
        rs.updateString(2,"234");
        rs.updateRow();
        rs.close();
       
        // Verify that the data was correctly updated
        String[][] expected = {{"234", "aa"}, {"2", "234"}, {"3", "cc"}};
View Full Code Here

       
        rs = stmt.executeQuery("SELECT * FROM selfReferencingT2 FOR UPDATE");
        assertTrue("FAIL - row not found", rs.next());
        assertEquals("FAIL - wrong value for column1", "e1", rs.getString(1));
        // update row should fail because cascade constraint is update restrict
        rs.updateString(1,"e2");
        try {
            rs.updateRow();
            fail("FAIL - this update should have caused violation of foreign " +
                    "key constraint");
        } catch (SQLException e) {
View Full Code Here

            assertSQLState(sqlState, e);
        }
        println("Position the ResultSet with next()");
        assertTrue("FAIL - row not found", rs.next());
        println("Should be able to updateRow() on the current row now");
        rs.updateString(2,"234");
        rs.updateRow();
        rs.close();
       
        String[][] expected = {{"2", "234"}, {"3", "cc"}};
        rs = stmt.executeQuery("select * from t1");
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.