Java 类javax.sql.rowset.BaseRowSet 实例源码

项目:jdk8u-jdk    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetType")
public void commonRowSetTest0030(BaseRowSet rs) throws Exception {
    rs.setInt(1, 1);
    rs.setString(2, query);
    assertTrue(rs.getParams().length == 2);
    rs.clearParameters();
    assertTrue(rs.getParams().length == 0);
}
项目:openjdk-jdk10    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetType")
public void commonRowSetTest0030(BaseRowSet rs) throws Exception {
    rs.setInt(1, 1);
    rs.setString(2, query);
    assertTrue(rs.getParams().length == 2);
    rs.clearParameters();
    assertTrue(rs.getParams().length == 0);
}
项目:openjdk9    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetType")
public void commonRowSetTest0030(BaseRowSet rs) throws Exception {
    rs.setInt(1, 1);
    rs.setString(2, query);
    assertTrue(rs.getParams().length == 2);
    rs.clearParameters();
    assertTrue(rs.getParams().length == 0);
}
项目:jdk8u_jdk    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetType")
public void commonRowSetTest0030(BaseRowSet rs) throws Exception {
    rs.setInt(1, 1);
    rs.setString(2, query);
    assertTrue(rs.getParams().length == 2);
    rs.clearParameters();
    assertTrue(rs.getParams().length == 0);
}
项目:lookaside_java-1.8.0-openjdk    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetType")
public void commonRowSetTest0030(BaseRowSet rs) throws Exception {
    rs.setInt(1, 1);
    rs.setString(2, query);
    assertTrue(rs.getParams().length == 2);
    rs.clearParameters();
    assertTrue(rs.getParams().length == 0);
}
项目:cn1    文件:AbstractRowSetImpl.java   
private void setParameter(PreparedStatement ps) throws SQLException {
    Object[] params = getParams();
    for (int i = 0; i < params.length; i++) {
        if (params[i] instanceof Object[]) {
            Object[] objs = (Object[]) params[i];
            // character stream
            if (objs.length == 2) {
                ps.setCharacterStream(i + 1, (Reader) objs[0],
                        ((Integer) objs[1]).intValue());
            } else {
                int type = ((Integer) objs[2]).intValue();
                switch (type) {
                case BaseRowSet.ASCII_STREAM_PARAM:
                    ps.setAsciiStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.BINARY_STREAM_PARAM:
                    ps.setBinaryStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.UNICODE_STREAM_PARAM:
                    ps.setUnicodeStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                }
            }
        } else {
            ps.setObject(i + 1, params[i]);
        }
    }
}
项目:cn1    文件:CachedRowSetImpl.java   
private void setParameter(PreparedStatement ps) throws SQLException {
    Object[] params = getParams();
    for (int i = 0; i < params.length; i++) {
        if (params[i] instanceof Object[]) {
            Object[] objs = (Object[]) params[i];
            // character stream
            if (objs.length == 2) {
                ps.setCharacterStream(i + 1, (Reader) objs[0],
                        ((Integer) objs[1]).intValue());
            } else {
                int type = ((Integer) objs[2]).intValue();
                switch (type) {
                case BaseRowSet.ASCII_STREAM_PARAM:
                    ps.setAsciiStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.BINARY_STREAM_PARAM:
                    ps.setBinaryStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.UNICODE_STREAM_PARAM:
                    ps.setUnicodeStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                }
            }
        } else {
            ps.setObject(i + 1, params[i]);
        }
    }
}
项目:freeVM    文件:AbstractRowSetImpl.java   
private void setParameter(PreparedStatement ps) throws SQLException {
    Object[] params = getParams();
    for (int i = 0; i < params.length; i++) {
        if (params[i] instanceof Object[]) {
            Object[] objs = (Object[]) params[i];
            // character stream
            if (objs.length == 2) {
                ps.setCharacterStream(i + 1, (Reader) objs[0],
                        ((Integer) objs[1]).intValue());
            } else {
                int type = ((Integer) objs[2]).intValue();
                switch (type) {
                case BaseRowSet.ASCII_STREAM_PARAM:
                    ps.setAsciiStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.BINARY_STREAM_PARAM:
                    ps.setBinaryStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.UNICODE_STREAM_PARAM:
                    ps.setUnicodeStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                }
            }
        } else {
            ps.setObject(i + 1, params[i]);
        }
    }
}
项目:freeVM    文件:CachedRowSetImpl.java   
private void setParameter(PreparedStatement ps) throws SQLException {
    Object[] params = getParams();
    for (int i = 0; i < params.length; i++) {
        if (params[i] instanceof Object[]) {
            Object[] objs = (Object[]) params[i];
            // character stream
            if (objs.length == 2) {
                ps.setCharacterStream(i + 1, (Reader) objs[0],
                        ((Integer) objs[1]).intValue());
            } else {
                int type = ((Integer) objs[2]).intValue();
                switch (type) {
                case BaseRowSet.ASCII_STREAM_PARAM:
                    ps.setAsciiStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.BINARY_STREAM_PARAM:
                    ps.setBinaryStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.UNICODE_STREAM_PARAM:
                    ps.setUnicodeStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                }
            }
        } else {
            ps.setObject(i + 1, params[i]);
        }
    }
}
项目:jdk8u-jdk    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetTrueFalse")
public void commonRowSetTest0021(BaseRowSet rs, boolean val) throws Exception {
    rs.setShowDeleted(val);
    assertTrue(rs.getShowDeleted() == val);
}
项目:openjdk-jdk10    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetTrueFalse")
public void commonRowSetTest0021(BaseRowSet rs, boolean val) throws Exception {
    rs.setShowDeleted(val);
    assertTrue(rs.getShowDeleted() == val);
}
项目:openjdk9    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetTrueFalse")
public void commonRowSetTest0021(BaseRowSet rs, boolean val) throws Exception {
    rs.setShowDeleted(val);
    assertTrue(rs.getShowDeleted() == val);
}
项目:jdk8u_jdk    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetTrueFalse")
public void commonRowSetTest0021(BaseRowSet rs, boolean val) throws Exception {
    rs.setShowDeleted(val);
    assertTrue(rs.getShowDeleted() == val);
}
项目:lookaside_java-1.8.0-openjdk    文件:CommonRowSetTests.java   
@Test(dataProvider = "rowSetTrueFalse")
public void commonRowSetTest0021(BaseRowSet rs, boolean val) throws Exception {
    rs.setShowDeleted(val);
    assertTrue(rs.getShowDeleted() == val);
}
项目:cn1    文件:WebRowSetImpl.java   
@Override
public CachedRowSet createCopy() throws SQLException {
    WebRowSetImpl webRs = new WebRowSetImpl();
    CachedRowSet copyCrset = super.createCopy();
    copyCrset.beforeFirst();
    webRs.populate(copyCrset);
    webRs.setCommand(copyCrset.getCommand());
    Object[] params = ((CachedRowSetImpl) copyCrset).getParams();
    for (int i = 0; i < params.length; i++) {
        if (params[i] instanceof Object[]) {
            Object[] objs = (Object[]) params[i];
            // character stream
            if (objs.length == 2) {
                webRs.setCharacterStream(i + 1, (Reader) objs[0],
                        ((Integer) objs[1]).intValue());
            } else {
                int type = ((Integer) objs[2]).intValue();
                switch (type) {
                case BaseRowSet.ASCII_STREAM_PARAM:
                    webRs.setAsciiStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.BINARY_STREAM_PARAM:
                    webRs.setBinaryStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                }
            }
        } else {
            webRs.setObject(i + 1, params[i]);
        }
    }
    if (copyCrset.getUrl() != null) {
        webRs.setUrl(copyCrset.getUrl());
        webRs.setUsername(copyCrset.getUsername());
        webRs.setPassword(copyCrset.getPassword());
    } else if (copyCrset.getDataSourceName() != null) {
        webRs.setDataSourceName(copyCrset.getDataSourceName());
    }
    return webRs;
}
项目:cn1    文件:JdbcRowSetTest.java   
public void testResult() throws Exception {
    JdbcRowSet jrs = newJdbcRowSet();
    assertTrue(jrs instanceof BaseRowSet);
    jrs.setCommand("select * from USER_INFO");
    jrs.setUrl(DERBY_URL);

    // before execute
    assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, jrs.getType());
    assertTrue(jrs.getEscapeProcessing());

    assertEquals(Connection.TRANSACTION_READ_COMMITTED, jrs
            .getTransactionIsolation());

    try {
        assertEquals(ResultSet.FETCH_FORWARD, jrs.getFetchDirection());
        fail("Should throw NullPointerException");
    } catch (NullPointerException e) {
        // expected
    }

    assertEquals(0, jrs.getFetchSize());

    assertEquals(0, jrs.getMaxFieldSize());
    assertEquals(0, jrs.getMaxRows());

    assertEquals(0, jrs.getQueryTimeout());
    assertFalse(jrs.getShowDeleted());

    assertEquals(DERBY_URL, jrs.getUrl());
    assertNull(jrs.getUsername());
    assertNull(jrs.getPassword());

    jrs.execute();

    // after execute
    assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, jrs.getType());
    assertTrue(jrs.getEscapeProcessing());

    assertEquals(Connection.TRANSACTION_READ_COMMITTED, jrs
            .getTransactionIsolation());

    assertEquals(ResultSet.FETCH_FORWARD, jrs.getFetchDirection());
    assertEquals(0, jrs.getFetchSize());

    assertEquals(0, jrs.getMaxFieldSize());
    assertEquals(0, jrs.getMaxRows());

    assertEquals(0, jrs.getQueryTimeout());
    assertFalse(jrs.getShowDeleted());

    assertEquals(DERBY_URL, jrs.getUrl());
    assertNull(jrs.getUsername());
    assertNull(jrs.getPassword());

    assertTrue(jrs.next());
    assertEquals(1, jrs.getInt(1));

    assertTrue(jrs.absolute(3));

    assertTrue(jrs.absolute(1));

    assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType());

    assertTrue(jrs instanceof BaseRowSet);

    jrs.close();
}
项目:freeVM    文件:WebRowSetImpl.java   
@Override
public CachedRowSet createCopy() throws SQLException {
    WebRowSetImpl webRs = new WebRowSetImpl();
    CachedRowSet copyCrset = super.createCopy();
    copyCrset.beforeFirst();
    webRs.populate(copyCrset);
    webRs.setCommand(copyCrset.getCommand());
    Object[] params = ((CachedRowSetImpl) copyCrset).getParams();
    for (int i = 0; i < params.length; i++) {
        if (params[i] instanceof Object[]) {
            Object[] objs = (Object[]) params[i];
            // character stream
            if (objs.length == 2) {
                webRs.setCharacterStream(i + 1, (Reader) objs[0],
                        ((Integer) objs[1]).intValue());
            } else {
                int type = ((Integer) objs[2]).intValue();
                switch (type) {
                case BaseRowSet.ASCII_STREAM_PARAM:
                    webRs.setAsciiStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                case BaseRowSet.BINARY_STREAM_PARAM:
                    webRs.setBinaryStream(i + 1, (InputStream) objs[0],
                            ((Integer) objs[1]).intValue());
                    break;
                }
            }
        } else {
            webRs.setObject(i + 1, params[i]);
        }
    }
    if (copyCrset.getUrl() != null) {
        webRs.setUrl(copyCrset.getUrl());
        webRs.setUsername(copyCrset.getUsername());
        webRs.setPassword(copyCrset.getPassword());
    } else if (copyCrset.getDataSourceName() != null) {
        webRs.setDataSourceName(copyCrset.getDataSourceName());
    }
    return webRs;
}
项目:freeVM    文件:JdbcRowSetTest.java   
public void testResult() throws Exception {
    JdbcRowSet jrs = newJdbcRowSet();
    assertTrue(jrs instanceof BaseRowSet);
    jrs.setCommand("select * from USER_INFO");
    jrs.setUrl(DERBY_URL);

    // before execute
    assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, jrs.getType());
    assertTrue(jrs.getEscapeProcessing());

    assertEquals(Connection.TRANSACTION_READ_COMMITTED, jrs
            .getTransactionIsolation());

    try {
        assertEquals(ResultSet.FETCH_FORWARD, jrs.getFetchDirection());
        fail("Should throw NullPointerException");
    } catch (NullPointerException e) {
        // expected
    }

    assertEquals(0, jrs.getFetchSize());

    assertEquals(0, jrs.getMaxFieldSize());
    assertEquals(0, jrs.getMaxRows());

    assertEquals(0, jrs.getQueryTimeout());
    assertFalse(jrs.getShowDeleted());

    assertEquals(DERBY_URL, jrs.getUrl());
    assertNull(jrs.getUsername());
    assertNull(jrs.getPassword());

    jrs.execute();

    // after execute
    assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, jrs.getType());
    assertTrue(jrs.getEscapeProcessing());

    assertEquals(Connection.TRANSACTION_READ_COMMITTED, jrs
            .getTransactionIsolation());

    assertEquals(ResultSet.FETCH_FORWARD, jrs.getFetchDirection());
    assertEquals(0, jrs.getFetchSize());

    assertEquals(0, jrs.getMaxFieldSize());
    assertEquals(0, jrs.getMaxRows());

    assertEquals(0, jrs.getQueryTimeout());
    assertFalse(jrs.getShowDeleted());

    assertEquals(DERBY_URL, jrs.getUrl());
    assertNull(jrs.getUsername());
    assertNull(jrs.getPassword());

    assertTrue(jrs.next());
    assertEquals(1, jrs.getInt(1));

    assertTrue(jrs.absolute(3));

    assertTrue(jrs.absolute(1));

    assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType());

    assertTrue(jrs instanceof BaseRowSet);

    jrs.close();
}