當前位置: 首頁>>代碼示例>>Java>>正文


Java CachedRowSet.close方法代碼示例

本文整理匯總了Java中javax.sql.rowset.CachedRowSet.close方法的典型用法代碼示例。如果您正苦於以下問題:Java CachedRowSet.close方法的具體用法?Java CachedRowSet.close怎麽用?Java CachedRowSet.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.sql.rowset.CachedRowSet的用法示例。


在下文中一共展示了CachedRowSet.close方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:33,代碼來源:CommonCachedRowSetTests.java

示例2: 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:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:CommonCachedRowSetTests.java

示例3: joinRowSetTests0006

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0006(CachedRowSet crs, CachedRowSet crs1)
        throws Exception {

    try (JoinRowSet jrs = newInstance()) {
        crs.setMatchColumn(COFFEES_JOIN_COLUMN_INDEX);
        crs1.setMatchColumn(SUPPLIERS_JOIN_COLUMN_INDEX);

        jrs.addRowSet(crs);
        jrs.addRowSet(crs1);
        validateResults(jrs);
        crs.close();
        crs1.close();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:JoinRowSetTests.java

示例4: joinRowSetTests0005

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0005(CachedRowSet crs, CachedRowSet crs1)
        throws Exception {

    try (JoinRowSet jrs = newInstance()) {
        crs.setMatchColumn(JOIN_COLNAME);
        crs1.setMatchColumn(JOIN_COLNAME);
        jrs.addRowSet(crs);
        jrs.addRowSet(crs1);
        validateResults(jrs);
        crs.close();
        crs1.close();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:JoinRowSetTests.java

示例5: 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

示例6: 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

示例7: joinRowSetTests0001

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0001(CachedRowSet crs, CachedRowSet crs1)
        throws Exception {

    try (JoinRowSet jrs = newInstance()) {
        jrs.addRowSet(crs, COFFEES_JOIN_COLUMN_INDEX);
        jrs.addRowSet(crs1, SUPPLIERS_JOIN_COLUMN_INDEX);
        validateResults(jrs);
        crs.close();
        crs1.close();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:13,代碼來源:JoinRowSetTests.java

示例8: commonCachedRowSetTest0054

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0054(CachedRowSet rs) throws Exception {
    int rowToDelete = 1961;
    assertTrue(rs.size() == COFFEE_HOUSES_ROWS);
    // Add new row
    rs.moveToInsertRow();
    rs.updateInt(1, rowToDelete);
    rs.updateString(2, "GOTHAM");
    rs.updateInt(3, 3450);
    rs.updateInt(4, 2005);
    rs.updateInt(5, 5455);
    rs.insertRow();
    rs.moveToCurrentRow();
    // check that the number of rows has increased
    assertTrue(rs.size() == COFFEE_HOUSES_ROWS + 1);
    assertTrue(findRowByPrimaryKey(rs, rowToDelete, 1));
    rs.absolute(COFFEE_HOUSES_ROWS + 1);
    rs.deleteRow();
    // Check to make sure the row is no longer there
    //assertTrue(rs.size() ==  COFFEE_HOUSES_ROWS);
    assertFalse(findRowByPrimaryKey(rs, rowToDelete, 1));
    rs.setShowDeleted(true);
    rs.absolute(COFFEE_HOUSES_ROWS + 1);
    rs.undoDelete();
    // check that the row is back
    assertTrue(rs.size() == COFFEE_HOUSES_ROWS + 1);
    assertTrue(findRowByPrimaryKey(rs, rowToDelete, 1));
    rs.close();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:30,代碼來源:CommonCachedRowSetTests.java

示例9: joinRowSetTests0002

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0002(CachedRowSet crs, CachedRowSet crs1)
        throws Exception {

    try (JoinRowSet jrs = newInstance()) {
        RowSet[] rowsets = {crs, crs1};
        String[] joinCols = {JOIN_COLNAME, JOIN_COLNAME};
        jrs.addRowSet(rowsets, joinCols);
        validateResults(jrs);
        crs.close();
        crs1.close();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:JoinRowSetTests.java

示例10: commonCachedRowSetTest0046

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses",
        expectedExceptions = SQLException.class)
public void commonCachedRowSetTest0046(CachedRowSet rs) throws Exception {
    rs.setShowDeleted(true);
    rs.afterLast();
    rs.undoDelete();
    rs.close();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:9,代碼來源:CommonCachedRowSetTests.java

示例11: commonCachedRowSetTest0018

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses", enabled = false)
public void commonCachedRowSetTest0018(CachedRowSet rs) throws Exception {
    int[] expectedCols = {1, 3};
    String[] expectedColNames = {"COF_ID", "SUP_ID"};
    rs.setMatchColumn(expectedCols);
    int[] actualCols = rs.getMatchColumnIndexes();
    String[] actualColNames = rs.getMatchColumnNames();
    assertEquals(actualCols, expectedCols);
    assertEquals(actualColNames, expectedColNames);
    assertEquals(actualCols, expectedCols);
    rs.close();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:13,代碼來源:CommonCachedRowSetTests.java

示例12: commonCachedRowSetTest0044

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses",
        expectedExceptions = SQLException.class)
public void commonCachedRowSetTest0044(CachedRowSet rs) throws Exception {
    rs.insertRow();
    rs.undoDelete();
    rs.close();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:CommonCachedRowSetTests.java

示例13: 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

示例14: joinRowSetTests0003

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0003(CachedRowSet crs, CachedRowSet crs1)
        throws Exception {

    try (JoinRowSet jrs = newInstance()) {
        RowSet[] rowsets = {crs, crs1};
        int[] joinCols = {COFFEES_JOIN_COLUMN_INDEX,
            SUPPLIERS_JOIN_COLUMN_INDEX};
        jrs.addRowSet(rowsets, joinCols);
        validateResults(jrs);
        crs.close();
        crs1.close();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:JoinRowSetTests.java

示例15: commonCachedRowSetTest0001

import javax.sql.rowset.CachedRowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowSetType", expectedExceptions = SyncProviderException.class)
public void commonCachedRowSetTest0001(CachedRowSet rs) throws Exception {
    rs.acceptChanges(null);
    rs.close();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:6,代碼來源:CommonCachedRowSetTests.java


注:本文中的javax.sql.rowset.CachedRowSet.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。