当前位置: 首页>>代码示例>>Java>>正文


Java CachedRowSet.beforeFirst方法代码示例

本文整理汇总了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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:33,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:CommonCachedRowSetTests.java

示例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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:CommonCachedRowSetTests.java


注:本文中的javax.sql.rowset.CachedRowSet.beforeFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。