本文整理匯總了Java中javax.sql.rowset.CachedRowSet.beforeFirst方法的典型用法代碼示例。如果您正苦於以下問題:Java CachedRowSet.beforeFirst方法的具體用法?Java CachedRowSet.beforeFirst怎麽用?Java CachedRowSet.beforeFirst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.sql.rowset.CachedRowSet
的用法示例。
在下文中一共展示了CachedRowSet.beforeFirst方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: commonCachedRowSetTest0059
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffees", enabled = true)
public void commonCachedRowSetTest0059(CachedRowSet rs) throws Exception {
int rowToDelete = 2;
try (CachedRowSet crs1 = rsf.createCachedRowSet()) {
rs.beforeFirst();
crs1.populate(rs);
TestRowSetListener rsl = new TestRowSetListener();
crs1.addRowSetListener(rsl);
// Delete a row, the PK is also the absolute position as a List
// backs the RowSet
crs1.absolute(rowToDelete);
crs1.deleteRow();
assertTrue(crs1.rowDeleted());
assertFalse(findRowByPrimaryKey(crs1, rowToDelete, 1));
// Restore back to our original state and the
// previously deleted row should be there
rsl.resetFlag();
crs1.restoreOriginal();
assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
assertTrue(crs1.isBeforeFirst());
crs1.absolute(rowToDelete);
assertFalse(crs1.rowDeleted());
assertTrue(findRowByPrimaryKey(crs1, rowToDelete, 1));
}
rs.close();
}
示例2: commonCachedRowSetTest0034
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0034(CachedRowSet rs) throws Exception {
Object[] cities = {"Mendocino", "Seattle", "SF", "Portland", "SF",
"Sacramento", "Carmel", "LA", "Olympia", "Seattle", "SF",
"LA", "San Jose", "Eugene"};
rs.beforeFirst();
assertEquals(rs.toCollection(2).toArray(), cities);
assertEquals(rs.toCollection("CITY").toArray(), cities);
rs.close();
}
示例3: commonCachedRowSetTest0045
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses",
expectedExceptions = SQLException.class)
public void commonCachedRowSetTest0045(CachedRowSet rs) throws Exception {
rs.setShowDeleted(true);
rs.beforeFirst();
rs.undoDelete();
rs.close();
}
示例4: commonCachedRowSetTest0048
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses",
expectedExceptions = SQLException.class)
public void commonCachedRowSetTest0048(CachedRowSet rs) throws Exception {
rs.setShowDeleted(true);
rs.beforeFirst();
rs.undoUpdate();
rs.close();
}
示例5: commonCachedRowSetTest0051
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses",
expectedExceptions = SQLException.class)
public void commonCachedRowSetTest0051(CachedRowSet rs) throws Exception {
rs.setShowDeleted(true);
rs.beforeFirst();
rs.undoInsert();
rs.close();
}
示例6: commonCachedRowSetTest0058
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0058(CachedRowSet rs) throws Exception {
int rowToInsert = 1961;
assertTrue(rs.size() == COFFEE_HOUSES_ROWS);
try ( // Add new row
CachedRowSet crs1 = rsf.createCachedRowSet()) {
rs.beforeFirst();
crs1.populate(rs);
TestRowSetListener rsl = new TestRowSetListener();
crs1.addRowSetListener(rsl);
crs1.moveToInsertRow();
crs1.updateInt(1, rowToInsert);
crs1.updateString(2, "GOTHAM");
crs1.updateInt(3, 3450);
crs1.updateInt(4, 2005);
crs1.updateInt(5, 5455);
crs1.insertRow();
assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED));
crs1.moveToCurrentRow();
assertTrue(findRowByPrimaryKey(crs1, rowToInsert, 1));
// Restore back to our original state and the
// previously inserted row should not be there
rsl.resetFlag();
crs1.restoreOriginal();
assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
assertTrue(crs1.isBeforeFirst());
crs1.last();
assertFalse(crs1.rowInserted());
assertFalse(findRowByPrimaryKey(crs1, rowToInsert, 1));
}
rs.close();
}
示例7: commonCachedRowSetTest0060
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffees", enabled = true)
public void commonCachedRowSetTest0060(CachedRowSet rs) throws Exception {
int rowToUpdate = 2;
String coffee = "Hazelnut";
try (CachedRowSet crs1 = rsf.createCachedRowSet()) {
rs.beforeFirst();
crs1.populate(rs);
TestRowSetListener rsl = new TestRowSetListener();
crs1.addRowSetListener(rsl);
// Delete a row, the PK is also the absolute position as a List
// backs the RowSet
crs1.absolute(rowToUpdate);
String origCoffee = crs1.getString(2);
crs1.updateString(2, coffee);
assertTrue(crs1.columnUpdated(2));
crs1.updateRow();
assertTrue(crs1.rowUpdated());
assertFalse(origCoffee.equals(crs1.getString(2)));
// Restore back to our original state and the
// previous value for the column within the row should be there
rsl.resetFlag();
crs1.restoreOriginal();
assertTrue(rsl.isNotified(TestRowSetListener.ROWSET_CHANGED));
assertTrue(crs1.isBeforeFirst());
// absolute() is failing for some reason so need to look at this later
crs1.next();
crs1.next();
assertFalse(crs1.columnUpdated(2));
assertFalse(crs1.rowUpdated());
assertTrue(origCoffee.equals(crs1.getString(2)));
}
rs.close();
}
示例8: commonCachedRowSetTest0061
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0061(CachedRowSet rs) throws Exception {
try (CachedRowSet crs1 = rsf.createCachedRowSet()) {
rs.beforeFirst();
crs1.populate(rs);
compareRowSets(rs, crs1);
}
rs.close();
}
示例9: commonCachedRowSetTest0062
import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0062(CachedRowSet rs) throws Exception {
Object[] expectedRows = {
32001, 10042, 10024, 10039, 10041, 33005, 33010, 10035, 10037,
10034, 32004
};
int startingRow = 4;
try (CachedRowSet crs1 = rsf.createCachedRowSet()) {
rs.beforeFirst();
crs1.populate(rs, startingRow);
assertEquals(crs1.size(), COFFEE_HOUSES_ROWS - startingRow + 1);
assertEquals(getPrimaryKeys(crs1), expectedRows);
}
rs.close();
}