642643644645646647648649650651652
jrs.moveToInsertRow(); jrs.updateInt(1, 6); jrs.updateString(2, "insert6"); jrs.insertRow(); jrs.moveToCurrentRow(); assertTrue(jrs.last()); assertEquals(6, jrs.getInt(1)); assertTrue(jrs.previous()); assertEquals(5, jrs.getInt(1));
674675676677678679680681682683684
jrs.updateString(2, "insert6"); jrs.insertRow(); jrs.updateInt(1, 7); jrs.updateString(2, "insert7"); jrs.insertRow(); jrs.moveToCurrentRow(); int index = 0; jrs.beforeFirst(); while (jrs.next()) { index++;
715716717718719720721722723724725
jrs.insertRow(); jrs.moveToInsertRow(); jrs.updateInt(1, 10); jrs.updateString(2, "insert10"); jrs.insertRow(); jrs.moveToCurrentRow(); /* * Check JdbcRowSet */ assertEquals(7, jrs.getInt(1));
751752753754755756757758759760761
jrs.cancelRowUpdates(); fail("should throw SQLException"); } catch (SQLException e) { // expected } jrs.moveToCurrentRow(); assertTrue(jrs.absolute(3)); jrs.updateString(2, "update3"); jrs.updateRow(); assertTrue(jrs.rowUpdated());
10781079108010811082108310841085108610871088
} catch (SQLException e) { // expected } jrs.isReadOnly(); try { jrs.moveToCurrentRow(); fail("should throw SQLException"); } catch (SQLException e) { // expected } try {
11671168116911701171117211731174117511761177
// Inserts a new row. jrs.moveToInsertRow(); jrs.updateInt(1, 5); jrs.updateString(2, "test5"); jrs.insertRow(); jrs.moveToCurrentRow(); // Tests if jrs has the same behaviour with connection when commit in // auto-commit mode. boolean hasCommitException = true;
12041205120612071208120912101211121212131214
// Inserts a row. jrs.moveToInsertRow(); jrs.updateInt(1, 6); jrs.updateString(2, "test6"); jrs.insertRow(); jrs.moveToCurrentRow(); assertTrue(jrs.absolute(6)); assertEquals(6, jrs.getInt(1)); // Commits jrs.commit();
12401241124212431244124512461247124812491250
// Inserts a new row. jrs.moveToInsertRow(); jrs.updateInt(1, 5); jrs.updateString(2, "test5"); jrs.insertRow(); jrs.moveToCurrentRow(); assertTrue(jrs.absolute(5)); assertEquals(5, jrs.getInt(1)); // Set autoCommit to false.
12531254125512561257125812591260126112621263
// Inserts a row. jrs.moveToInsertRow(); jrs.updateInt(1, 6); jrs.updateString(2, "test6"); jrs.insertRow(); jrs.moveToCurrentRow(); assertTrue(jrs.absolute(6)); assertEquals(6, jrs.getInt(1)); // Rollbacks jrs.rollback();
627628629630631632633634635636637
jrs.moveToInsertRow(); jrs.updateInt(1, 5); jrs.updateString(2, "insert5"); jrs.insertRow(); jrs.moveToCurrentRow(); // check the inserted row assertTrue(jrs.absolute(5)); /* * If uncommenting the following line, then the inserted row which ID is