Java Code Examples for java.sql.ResultSet#refreshRow()
The following examples show how to use
java.sql.ResultSet#refreshRow() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnsupportedOperationResultSetTest.java From sharding-jdbc-1.5.1 with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertRefreshRow() throws SQLException { for (ResultSet each : resultSets) { each.refreshRow(); } }
Example 2
Source File: UnsupportedOperationResultSetTest.java From shardingsphere with Apache License 2.0 | 4 votes |
@Test(expected = SQLFeatureNotSupportedException.class) public void assertRefreshRow() throws SQLException { for (ResultSet each : resultSets) { each.refreshRow(); } }
Example 3
Source File: ClientSideCursorTest.java From jTDS with GNU Lesser General Public License v2.1 | 4 votes |
/** * General test of scrollable cursor functionality. * <p/> * When running on SQL Server this test will exercise MSCursorResultSet. * When running on Sybase this test will exercise CachedResultSet. */ public void testCachedCursor() throws Exception { try { dropTable("jTDS_CachedCursorTest"); Statement stmt = con.createStatement(); stmt.execute("CREATE TABLE jTDS_CachedCursorTest " + "(key1 int NOT NULL, key2 char(4) NOT NULL," + "data varchar(255))\r\n" + "ALTER TABLE jTDS_CachedCursorTest " + "ADD CONSTRAINT PK_jTDS_CachedCursorTest PRIMARY KEY CLUSTERED" + "( key1, key2)"); for (int i = 1; i <= 16; i++) { assertEquals(1, stmt.executeUpdate("INSERT INTO jTDS_CachedCursorTest VALUES(" + i + ", 'XXXX','LINE " + i + "')")); } stmt.close(); stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT * FROM jTDS_CachedCursorTest ORDER BY key1"); assertNotNull(rs); assertEquals(null, stmt.getWarnings()); assertTrue(rs.isBeforeFirst()); assertTrue(rs.first()); assertEquals(1, rs.getInt(1)); assertTrue(rs.isFirst()); assertTrue(rs.last()); assertEquals(16, rs.getInt(1)); assertTrue(rs.isLast()); assertFalse(rs.next()); assertTrue(rs.isAfterLast()); rs.beforeFirst(); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); rs.afterLast(); assertTrue(rs.previous()); assertEquals(16, rs.getInt(1)); assertTrue(rs.absolute(8)); assertEquals(8, rs.getInt(1)); assertTrue(rs.relative(-1)); assertEquals(7, rs.getInt(1)); rs.updateString(3, "New line 7"); rs.updateRow(); // assertTrue(rs.rowUpdated()); // MS API cursors appear not to support this rs.moveToInsertRow(); rs.updateInt(1, 17); rs.updateString(2, "XXXX"); rs.updateString(3, "LINE 17"); rs.insertRow(); rs.moveToCurrentRow(); rs.last(); // assertTrue(rs.rowInserted()); // MS API cursors appear not to support this Statement stmt2 = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs2 = stmt2.executeQuery("SELECT * FROM jTDS_CachedCursorTest ORDER BY key1"); rs.updateString(3, "NEW LINE 17"); rs.updateRow(); assertTrue(rs2.last()); assertEquals(17, rs2.getInt(1)); assertEquals("NEW LINE 17", rs2.getString(3)); rs.deleteRow(); rs2.refreshRow(); assertTrue(rs2.rowDeleted()); rs2.close(); stmt2.close(); rs.close(); stmt.close(); } finally { dropTable("jTDS_CachedCursorTest"); } }