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


Java JoinRowSet类代码示例

本文整理汇总了Java中javax.sql.rowset.JoinRowSet的典型用法代码示例。如果您正苦于以下问题:Java JoinRowSet类的具体用法?Java JoinRowSet怎么用?Java JoinRowSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JoinRowSet类属于javax.sql.rowset包,在下文中一共展示了JoinRowSet类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateResults

import javax.sql.rowset.JoinRowSet; //导入依赖的package包/类
private void validateResults(final JoinRowSet jrs) throws SQLException {
    List<Integer> results = new ArrayList<>();
    jrs.beforeFirst();
    while (jrs.next()) {
        if (jrs.getInt(JOIN_COLNAME) == SUP_ID) {
            results.add(jrs.getInt("COF_ID"));
        }
    }
    assertEquals(results.toArray(), EXPECTED);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:11,代码来源:JoinRowSetTests.java

示例2: joinRowSetTests0000

import javax.sql.rowset.JoinRowSet; //导入依赖的package包/类
@Test(dataProvider = "createCachedRowSetsToUse")
public void joinRowSetTests0000(CachedRowSet crs, CachedRowSet crs1)
        throws Exception {

    try (JoinRowSet jrs = newInstance()) {
        jrs.addRowSet(crs, JOIN_COLNAME);
        jrs.addRowSet(crs1, JOIN_COLNAME);
        validateResults(jrs);
        crs.close();
        crs1.close();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:13,代码来源:JoinRowSetTests.java

示例3: joinRowSetTests0001

import javax.sql.rowset.JoinRowSet; //导入依赖的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

示例4: joinRowSetTests0002

import javax.sql.rowset.JoinRowSet; //导入依赖的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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:JoinRowSetTests.java

示例5: joinRowSetTests0003

import javax.sql.rowset.JoinRowSet; //导入依赖的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

示例6: joinRowSetTests0005

import javax.sql.rowset.JoinRowSet; //导入依赖的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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:JoinRowSetTests.java

示例7: joinRowSetTests0006

import javax.sql.rowset.JoinRowSet; //导入依赖的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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:JoinRowSetTests.java

示例8: testReadXml_Empty

import javax.sql.rowset.JoinRowSet; //导入依赖的package包/类
public void testReadXml_Empty() throws Exception {
    jrs = newJoinRowSet();
    jrs.addRowSet(crset, 1);
    StringWriter writer = new StringWriter();
    jrs.writeXml(writer);

    JoinRowSet another = newJoinRowSet();
    another.readXml(new StringReader(writer.getBuffer().toString()));

    assertCachedRowSetEquals(jrs, another);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:JoinRowSetWebRowSetTest.java

示例9: testWriteAndRead_Insert

import javax.sql.rowset.JoinRowSet; //导入依赖的package包/类
public void testWriteAndRead_Insert() throws Exception {
    jrs.addRowSet(crset, 1);
    jrs.beforeFirst();
    assertTrue(jrs.next());
    jrs.moveToInsertRow();
    jrs.updateInt(1, 5);
    jrs.updateString(2, "insertrow");
    jrs.insertRow();
    jrs.moveToCurrentRow();
    jrs.beforeFirst();

    jrs.absolute(2);
    assertTrue(jrs.rowInserted());

    StringWriter writer = new StringWriter();
    jrs.writeXml(writer);

    JoinRowSet another = newJoinRowSet();
    another.readXml(new StringReader(writer.getBuffer().toString()));

    if (System.getProperty("Testing Harmony") == "true") {
        assertCachedRowSetEquals(jrs, another);
    } else {
        // TODO why the output xml has no insert information.
        another.absolute(2);
        assertFalse(another.rowInserted());
        jrs.absolute(2);
        assertTrue(jrs.rowInserted());
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:31,代码来源:JoinRowSetWebRowSetTest.java

示例10: testWriteAndRead_Update

import javax.sql.rowset.JoinRowSet; //导入依赖的package包/类
public void testWriteAndRead_Update() throws Exception {
    jrs.addRowSet(crset, 1);
    jrs.beforeFirst();

    assertTrue(jrs.absolute(3));
    jrs.updateString(2, "updateRow");
    jrs.updateRow();

    assertTrue(jrs.next());
    jrs.updateString(2, "anotherUpdateRow");
    jrs.updateRow();

    StringWriter writer = new StringWriter();

    jrs.writeXml(writer);

    JoinRowSet another = newJoinRowSet();
    another.readXml(new StringReader(writer.getBuffer().toString()));


    if (System.getProperty("Testing Harmony") == "true") {
        assertCachedRowSetEquals(jrs, another);
    } else {
        another.absolute(3);
        assertFalse(another.rowUpdated());
        jrs.absolute(3);
        assertTrue(jrs.rowUpdated());
        
        // TODO why the output xml has no update information.
        another.absolute(4);
        assertFalse(another.rowUpdated());
        jrs.absolute(4);
        assertTrue(jrs.rowUpdated());
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:36,代码来源:JoinRowSetWebRowSetTest.java

示例11: testWriteXmlLResultSet

import javax.sql.rowset.JoinRowSet; //导入依赖的package包/类
public void testWriteXmlLResultSet() throws Exception {
    StringWriter writer = new StringWriter();
    rs = st.executeQuery("select * from user_info");
    jrs.writeXml(rs, writer);
    
    JoinRowSet jrs2 = newJoinRowSet();
    jrs2.readXml(new StringReader(writer.getBuffer().toString()));
    assertCachedRowSetEquals(crset, jrs2);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:JoinRowSetWebRowSetTest.java


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