Java Code Examples for javax.sql.rowset.JoinRowSet#beforeFirst()

The following examples show how to use javax.sql.rowset.JoinRowSet#beforeFirst() . 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: JoinRowSetTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: JoinRowSetTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: JoinRowSetTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: JoinRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: JoinRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 6
Source File: JoinRowSetTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: JoinRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 8
Source File: JoinRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 9
Source File: JoinRowSetTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 10
Source File: JdbcRowSetLiveTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void createCachedRowSets_DoJoinRowSet_ThenCorrect() throws Exception {

    CachedRowSetImpl customers = new CachedRowSetImpl();
    customers.setUsername(username);
    customers.setPassword(password);
    customers.setUrl(url);
    customers.setCommand(sql);
    customers.execute();

    CachedRowSetImpl associates = new CachedRowSetImpl();
    associates.setUsername(username);
    associates.setPassword(password);
    associates.setUrl(url);
    String associatesSQL = "SELECT * FROM associates";
    associates.setCommand(associatesSQL);
    associates.execute();

    JoinRowSet jrs = new JoinRowSetImpl();
    final String ID = "id";
    final String NAME = "name";
    jrs.addRowSet(customers, ID);
    jrs.addRowSet(associates, ID);
    jrs.last();
    System.out.println("Total rows: " + jrs.getRow());
    jrs.beforeFirst();
    while (jrs.next()) {

        String string1 = jrs.getString(ID);
        String string2 = jrs.getString(NAME);
        System.out.println("ID: " + string1 + ", NAME: " + string2);
    }
}