本文整理汇总了Java中javax.sql.rowset.RowSetMetaDataImpl类的典型用法代码示例。如果您正苦于以下问题:Java RowSetMetaDataImpl类的具体用法?Java RowSetMetaDataImpl怎么用?Java RowSetMetaDataImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RowSetMetaDataImpl类属于javax.sql.rowset包,在下文中一共展示了RowSetMetaDataImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listVirtualPartitionedTable
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
public ResultSet listVirtualPartitionedTable() throws SQLException, RemoteException {
int i = 0;
PargresRowSet rs = new PargresRowSet();
RowSetMetaDataImpl meta = new RowSetMetaDataImpl();
meta.setColumnCount(1);
meta.setColumnName(1, "DUMMY");
meta.setColumnType(1, Types.VARCHAR);
rs.setMetaData(meta);
for(org.pargres.commons.Range range : getMetaData().getRangeList()) {
String list = i+" - "+(String)range.getTableName()+"\t: "+(String)range.getField()+
"\t[cardinality = "+range.getCardinality()+", " +
"range init = "+range.getRangeInit()+", " +
"range end = "+range.getRangeEnd()+"]\n";
i++;
rs.moveToInsertRow();
rs.updateString(1, list);
rs.insertRow();
rs.moveToCurrentRow();
}
return rs;
}
示例2: getColIdxByName
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
/**
* Returns the column number of the column with the given name in this
* <code>CachedRowSetImpl</code> object. This method throws an
* <code>SQLException</code> if the given name is not the name of one of the
* columns in this rowset.
*
* @param name
* a <code>String</code> object that is the name of a column in
* this <code>CachedRowSetImpl</code> object
* @throws SQLException
* if the given name does not match the name of one of the
* columns in this rowset
*/
private int getColIdxByName(String name) throws SQLException {
RowSetMD = (RowSetMetaDataImpl) this.getMetaData();
int cols = RowSetMD.getColumnCount();
for (int i = 1; i <= cols; ++i) {
String colName = RowSetMD.getColumnName(i);
if (colName != null)
if (name.equalsIgnoreCase(colName))
return (i);
else
continue;
}
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalcolnm").toString());
}
示例3: testNextPreviousConflict
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
public void testNextPreviousConflict() throws Exception {
RowSetMetaData metadata = new RowSetMetaDataImpl();
metadata.setColumnCount(DEFAULT_COLUMN_COUNT);
SyncResolverImpl resolver = new SyncResolverImpl(metadata);
resolver.addConflictRow(
new CachedRow(new Object[DEFAULT_COLUMN_COUNT]), 1,
SyncResolver.INSERT_ROW_CONFLICT);
resolver.addConflictRow(
new CachedRow(new Object[DEFAULT_COLUMN_COUNT]), 2,
SyncResolver.INSERT_ROW_CONFLICT);
assertTrue(resolver.nextConflict());
assertTrue(resolver.nextConflict());
assertFalse(resolver.nextConflict());
assertFalse(resolver.nextConflict());
assertTrue(resolver.previousConflict());
assertTrue(resolver.previousConflict());
assertFalse(resolver.previousConflict());
assertFalse(resolver.previousConflict());
}
示例4: getNodesList
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
public ResultSet getNodesList() throws SQLException, RemoteException {
PargresRowSet rs = new PargresRowSet();
RowSetMetaDataImpl meta = new RowSetMetaDataImpl();
meta.setColumnCount(1);
meta.setColumnName(1, "DUMMY");
meta.setColumnType(1, Types.VARCHAR);
rs.setMetaData(meta);
int i = 0;
for (Node node : nodes) {
String item = i + ":" + node.getAddress().toString();
if(i != nodes.size() - 1)
item += ";";
i++;
rs.moveToInsertRow();
rs.updateString(1, item);
rs.insertRow();
rs.moveToCurrentRow();
}
return rs;
}
示例5: initCoffeesMetaData
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
protected void initCoffeesMetaData(CachedRowSet crs) throws SQLException {
RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl();
crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE);
/*
* CREATE TABLE COFFEES (
* COF_ID INTEGER NOT NULL,
* COF_NAME VARCHAR(32) NOT NULL,
* SUP_ID INTEGER NOT NULL,
* PRICE NUMBERIC(10,2 NOT NULL,
* SALES INTEGER NOT NULL,
* TOTAL INTEGER NOT NULL,
* PRIMARY KEY (COF_ID),
* FOREIGN KEY (SUP_ID) REFERENCES SUPPLIERS (SUP_ID) )
*/
rsmd.setColumnCount(COFFEES_COLUMN_NAMES.length);
for(int i = 1; i <= COFFEES_COLUMN_NAMES.length; i++){
rsmd.setColumnName(i, COFFEES_COLUMN_NAMES[i-1]);
rsmd.setColumnLabel(i, rsmd.getColumnName(i));
}
rsmd.setColumnType(1, Types.INTEGER);
rsmd.setColumnType(2, Types.VARCHAR);
rsmd.setColumnType(3, Types.INTEGER);
rsmd.setColumnType(4, Types.NUMERIC);
rsmd.setPrecision(4, 10);
rsmd.setScale(4, 2);
rsmd.setColumnType(5, Types.INTEGER);
rsmd.setColumnType(6, Types.INTEGER);
crs.setMetaData(rsmd);
crs.setTableName(COFFEES_TABLE);
}
示例6: HelloRowSet
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
public HelloRowSet() throws SQLException {
super();
RowSetMetaDataImpl meta = new RowSetMetaDataImpl();
meta.setColumnCount(1);
meta.setColumnName(1, "DUMMY");
meta.setColumnType(1, Types.VARCHAR);
this.setMetaData(meta);
this.moveToInsertRow();
this.updateString(1, JdbcUtil.TEST_QUERY_RESPONSE);
this.insertRow();
this.moveToCurrentRow();
}
示例7: test99
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void test99() throws Exception {
RowSetMetaData rsmd1 = rsmd;
ResultSetMetaData rsmd2 = rsmd;
Class clzz = rsmd.getClass();
assertTrue(rsmd1.isWrapperFor(clzz));
assertTrue(rsmd2.isWrapperFor(clzz));
RowSetMetaDataImpl rsmdi = (RowSetMetaDataImpl) rsmd2.unwrap(clzz);
// False should be returned
assertFalse(rsmd1.isWrapperFor(this.getClass()));
assertFalse(rsmd2.isWrapperFor(this.getClass()));
}
示例8: initCoffeeHousesMetaData
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
private void initCoffeeHousesMetaData(CachedRowSet crs) throws SQLException {
RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl();
crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE);
/*
* CREATE TABLE COFFEE_HOUSES(
* STORE_ID Integer NOT NULL,
* CITY VARCHAR(32),
* COFFEE INTEGER NOT NULL,
* MERCH INTEGER NOT NULL,
* TOTAL INTEGER NOT NULL,
* PRIMARY KEY (STORE_ID))
*/
rsmd.setColumnCount(COFFEE_HOUSES_COLUMN_NAMES.length);
for(int i = 1; i <= COFFEE_HOUSES_COLUMN_NAMES.length; i++){
rsmd.setColumnName(i, COFFEE_HOUSES_COLUMN_NAMES[i-1]);
rsmd.setColumnLabel(i, rsmd.getColumnName(i));
}
rsmd.setColumnType(1, Types.INTEGER);
rsmd.setColumnType(2, Types.VARCHAR);
rsmd.setColumnType(3, Types.INTEGER);
rsmd.setColumnType(4, Types.INTEGER);
rsmd.setColumnType(5, Types.INTEGER);
crs.setMetaData(rsmd);
crs.setTableName(COFFEE_HOUSES_TABLE);
}
示例9: initDataTypesMetaData
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
protected void initDataTypesMetaData(CachedRowSet crs) throws SQLException {
RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl();
crs.setType(RowSet.TYPE_SCROLL_INSENSITIVE);
rsmd.setColumnCount(DATATYPES_COLUMN_NAMES.length);
for (int i = 1; i <= DATATYPES_COLUMN_NAMES.length; i++) {
rsmd.setColumnName(i, DATATYPES_COLUMN_NAMES[i - 1]);
rsmd.setColumnLabel(i, rsmd.getColumnName(i));
}
rsmd.setColumnType(1, Types.INTEGER);
rsmd.setColumnType(2, Types.CHAR);
rsmd.setColumnType(3, Types.VARCHAR);
rsmd.setColumnType(4, Types.BIGINT);
rsmd.setColumnType(5, Types.BOOLEAN);
rsmd.setColumnType(6, Types.SMALLINT);
rsmd.setColumnType(7, Types.DOUBLE);
rsmd.setColumnType(8, Types.DECIMAL);
rsmd.setColumnType(9, Types.REAL);
rsmd.setColumnType(10, Types.TINYINT);
rsmd.setColumnType(11, Types.DATE);
rsmd.setColumnType(12, Types.TIME);
rsmd.setColumnType(13, Types.TIMESTAMP);
rsmd.setColumnType(14, Types.VARBINARY);
rsmd.setColumnType(15, Types.ARRAY);
rsmd.setColumnType(16, Types.REF);
rsmd.setColumnType(17, Types.FLOAT);
crs.setMetaData(rsmd);
}
示例10: initSuppliersMetaData
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
private void initSuppliersMetaData(CachedRowSet crs) throws SQLException {
RowSetMetaDataImpl rsmd = new RowSetMetaDataImpl();
/*
* CREATE TABLE SUPPLIERS (
* SUP_ID INTEGER NOT NULL,
* SUP_NAME VARCHAR(32) NOT NULL,
* STREET VARCHAR(32) NOT NULL,
* CITY VARCHAR(32) NOT NULL,
* STATE CHAR(2) NOT NULL,
* ZIP CHAR(5) NOT NULL,
* PRIMARY KEY (SUP_ID))
*/
rsmd.setColumnCount(6);
rsmd.setColumnName(1, "SUP_ID");
rsmd.setColumnName(2, "SUP_NAME");
rsmd.setColumnName(3, "STREET");
rsmd.setColumnName(4, "CITY");
rsmd.setColumnName(5, "STATE");
rsmd.setColumnName(6, "ZIP");
rsmd.setColumnType(1, Types.INTEGER);
rsmd.setColumnType(2, Types.VARCHAR);
rsmd.setColumnType(3, Types.VARCHAR);
rsmd.setColumnType(4, Types.VARCHAR);
rsmd.setColumnType(5, Types.CHAR);
rsmd.setColumnType(6, Types.CHAR);
crs.setMetaData(rsmd);
crs.setTableName(SUPPLIERS_TABLE);
}
示例11: copyMetaData
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
protected RowSetMetaData copyMetaData(ResultSetMetaData metaData)
throws SQLException {
RowSetMetaDataImpl rowSetMetaData = new RowSetMetaDataImpl();
rowSetMetaData.setColumnCount(metaData.getColumnCount());
for (int columnIndex = 1; columnIndex <= metaData.getColumnCount(); columnIndex++) {
rowSetMetaData.setAutoIncrement(columnIndex, metaData
.isAutoIncrement(columnIndex));
doCopyMetaData(rowSetMetaData, columnIndex, metaData, columnIndex);
}
return rowSetMetaData;
}
示例12: composeMetaData
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
private void composeMetaData(ResultSetMetaData rsmd, int matchColumn)
throws SQLException {
if (getMetaData() == null) {
if (rsmd instanceof RowSetMetaData) {
setMetaData((RowSetMetaData) rsmd);
} else {
setMetaData(copyMetaData(rsmd));
}
} else {
int colCount = getMetaData().getColumnCount()
+ rsmd.getColumnCount() - 1;
RowSetMetaData rowSetMetaData = new RowSetMetaDataImpl();
rowSetMetaData.setColumnCount(colCount);
for (int i = 1; i <= getMetaData().getColumnCount(); i++) {
doCopyMetaData(rowSetMetaData, i, getMetaData(), i);
if (i == matchColIndexs.get(0).intValue()) {
rowSetMetaData.setColumnName(i, MERGED_COLUMN_NAME);
}
}
int index = 0;
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
if (j == matchColumn) {
continue;
}
index++;
doCopyMetaData(rowSetMetaData, getMetaData().getColumnCount()
+ index, rsmd, j);
}
setMetaData(rowSetMetaData);
}
}
示例13: assertDeserialized
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
public void assertDeserialized(Serializable initial,
Serializable deserialized) {
try {
RowSetMetaDataImpl initialImpl = (RowSetMetaDataImpl) initial;
RowSetMetaDataImpl deserializedImpl = (RowSetMetaDataImpl) deserialized;
Assert.assertEquals(initialImpl.getColumnCount(),
deserializedImpl.getColumnCount());
Assert.assertEquals(initialImpl.getColumnType(1),
deserializedImpl.getColumnType(1));
} catch (SQLException e) {
fail();
}
}
示例14: test_serialization_self
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
/**
* @tests serialization/deserialization.
*/
public void test_serialization_self() throws Exception {
RowSetMetaDataImpl impl = new RowSetMetaDataImpl();
impl.setColumnCount(1);
impl.setColumnType(1, Types.CHAR);
SerializationTest.verifySelf(impl, ROWSET_METADATA_COMPARATOR);
}
示例15: test_serialization_compatibility
import javax.sql.rowset.RowSetMetaDataImpl; //导入依赖的package包/类
/**
* @tests serialization/deserialization compatibility with RI.
*/
public void test_serialization_compatibility() throws Exception {
RowSetMetaDataImpl impl = new RowSetMetaDataImpl();
impl.setColumnCount(2);
impl.setColumnType(1, Types.ARRAY);
impl.setColumnType(2, Types.BIGINT);
SerializationTest.verifyGolden(this, impl, ROWSET_METADATA_COMPARATOR);
}