本文整理汇总了Java中javax.sql.rowset.BaseRowSet类的典型用法代码示例。如果您正苦于以下问题:Java BaseRowSet类的具体用法?Java BaseRowSet怎么用?Java BaseRowSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseRowSet类属于javax.sql.rowset包,在下文中一共展示了BaseRowSet类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: commonRowSetTest0030
import javax.sql.rowset.BaseRowSet; //导入依赖的package包/类
@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);
}
示例2: setParameter
import javax.sql.rowset.BaseRowSet; //导入依赖的package包/类
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]);
}
}
}
示例3: commonRowSetTest0021
import javax.sql.rowset.BaseRowSet; //导入依赖的package包/类
@Test(dataProvider = "rowSetTrueFalse")
public void commonRowSetTest0021(BaseRowSet rs, boolean val) throws Exception {
rs.setShowDeleted(val);
assertTrue(rs.getShowDeleted() == val);
}
示例4: createCopy
import javax.sql.rowset.BaseRowSet; //导入依赖的package包/类
@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;
}
示例5: testResult
import javax.sql.rowset.BaseRowSet; //导入依赖的package包/类
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();
}