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


Java RowSetMetaData类代码示例

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


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

示例1: initMetaData

import javax.sql.RowSetMetaData; //导入依赖的package包/类
protected void initMetaData(RowSetMetaData paramRowSetMetaData, ResultSetMetaData paramResultSetMetaData)
  throws SQLException
{
  int i = paramResultSetMetaData.getColumnCount();

  paramRowSetMetaData.setColumnCount(i);
  for (int j = 1; j <= i; j++) {
    paramRowSetMetaData.setAutoIncrement(j, paramResultSetMetaData.isAutoIncrement(j));
    paramRowSetMetaData.setCaseSensitive(j, paramResultSetMetaData.isCaseSensitive(j));
    paramRowSetMetaData.setCurrency(j, paramResultSetMetaData.isCurrency(j));
    paramRowSetMetaData.setNullable(j, paramResultSetMetaData.isNullable(j));
    paramRowSetMetaData.setSigned(j, paramResultSetMetaData.isSigned(j));
    paramRowSetMetaData.setSearchable(j, paramResultSetMetaData.isSearchable(j));
    paramRowSetMetaData.setColumnDisplaySize(j, paramResultSetMetaData.getColumnDisplaySize(j));
    paramRowSetMetaData.setColumnLabel(j, paramResultSetMetaData.getColumnLabel(j));
    paramRowSetMetaData.setColumnName(j, paramResultSetMetaData.getColumnName(j));
    paramRowSetMetaData.setSchemaName(j, paramResultSetMetaData.getSchemaName(j));
    paramRowSetMetaData.setPrecision(j, paramResultSetMetaData.getPrecision(j));
    paramRowSetMetaData.setScale(j, paramResultSetMetaData.getScale(j));
    paramRowSetMetaData.setTableName(j, paramResultSetMetaData.getTableName(j));
    paramRowSetMetaData.setCatalogName(j, paramResultSetMetaData.getCatalogName(j));
    paramRowSetMetaData.setColumnType(j, paramResultSetMetaData.getColumnType(j));
    paramRowSetMetaData.setColumnTypeName(j, paramResultSetMetaData.getColumnTypeName(j));
  }
}
 
开发者ID:arrahtech,项目名称:osdq-core,代码行数:26,代码来源:UpdatableJdbcRowsetImpl.java

示例2: doCopyMetaData

import javax.sql.RowSetMetaData; //导入依赖的package包/类
protected void doCopyMetaData(RowSetMetaData targetRsmd, int targetIndex,
        ResultSetMetaData srcRsmd, int srcIndex) throws SQLException {
    targetRsmd.setAutoIncrement(targetIndex, srcRsmd
            .isAutoIncrement(srcIndex));
    targetRsmd.setCaseSensitive(targetIndex, srcRsmd
            .isCaseSensitive(srcIndex));
    targetRsmd
            .setCatalogName(targetIndex, srcRsmd.getCatalogName(srcIndex));
    targetRsmd.setColumnDisplaySize(targetIndex, srcRsmd
            .getColumnDisplaySize(srcIndex));
    targetRsmd
            .setColumnLabel(targetIndex, srcRsmd.getColumnLabel(srcIndex));
    targetRsmd.setColumnName(targetIndex, srcRsmd.getColumnName(srcIndex));
    targetRsmd.setColumnType(targetIndex, srcRsmd.getColumnType(srcIndex));
    targetRsmd.setColumnTypeName(targetIndex, srcRsmd
            .getColumnTypeName(srcIndex));
    targetRsmd.setCurrency(targetIndex, srcRsmd.isCurrency(srcIndex));
    targetRsmd.setNullable(targetIndex, srcRsmd.isNullable(srcIndex));
    targetRsmd.setPrecision(targetIndex, srcRsmd.getPrecision(srcIndex));
    targetRsmd.setScale(targetIndex, srcRsmd.getScale(srcIndex));
    targetRsmd.setSchemaName(targetIndex, srcRsmd.getSchemaName(srcIndex));
    targetRsmd.setSearchable(targetIndex, srcRsmd.isSearchable(srcIndex));
    targetRsmd.setSigned(targetIndex, srcRsmd.isSigned(srcIndex));
    targetRsmd.setTableName(targetIndex, srcRsmd.getTableName(srcIndex));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:CachedRowSetImpl.java

示例3: testNextPreviousConflict

import javax.sql.RowSetMetaData; //导入依赖的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());
    }
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:SyncResolverTest.java

示例4: test99

import javax.sql.RowSetMetaData; //导入依赖的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()));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:RowSetMetaDataTests.java

示例5: populate

import javax.sql.RowSetMetaData; //导入依赖的package包/类
public void populate(ResultSet rs) throws PargresException {
	try {
		RowSetMetaData meta = new PargresRowSetMetaData(rs.getMetaData());
		//DAR UMA OLHADA NISSO!
		//this.beforeFirst();
		//this.setMetaData(meta);
		/*while(rs.next()) {
			this.moveToInsertRow();
			for(int i = 1; i <= meta.getColumnCount(); i++) {
				//Object o = rs.getObject(i);
				this.setString(i,"1");
				//if(o != null)
				//	this.setObject(i,rs.getObject(i));
			}
			this.insertRow();
		}*/
		this.beforeFirst();
		super.populate(new FixItResultSet(rs, meta));

		//if(!super.isBeforeFirst())
		beforeFirst();
		//rs.beforeFirst();

	} catch (Exception e) {
		e.printStackTrace();
		System.err.println(e);
		throw new PargresException(e.getMessage());
	}
}
 
开发者ID:assis,项目名称:ParGRES,代码行数:30,代码来源:PargresRowSet.java

示例6: testSetMetaData

import javax.sql.RowSetMetaData; //导入依赖的package包/类
/**
 * @tests {@link javax.sql.RowSetInternal#setMetaData(javax.sql.RowSetMetaData)}
 */
@TestTargetNew(
    level = TestLevel.NOT_FEASIBLE,
    notes = "",
    method = "setMetaData",
    args = {javax.sql.RowSetMetaData.class}
)
public void testSetMetaData() {
    fail("Not yet implemented");
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:13,代码来源:RowSetInternalTest.java

示例7: copyMetaData

import javax.sql.RowSetMetaData; //导入依赖的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;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:12,代码来源:CachedRowSetImpl.java

示例8: composeMetaData

import javax.sql.RowSetMetaData; //导入依赖的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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:32,代码来源:JoinRowSetImpl.java

示例9: setMetaData

import javax.sql.RowSetMetaData; //导入依赖的package包/类
@Override
public void setMetaData(RowSetMetaData md) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:5,代码来源:StubWebRowSetImpl.java

示例10: doPopulate

import javax.sql.RowSetMetaData; //导入依赖的package包/类
protected void doPopulate(ResultSet rs, boolean isPaging)
        throws SQLException {
    boolean oldIsNotifyListener = isNotifyListener;
    isNotifyListener = false;
    meta = copyMetaData(rs.getMetaData());

    columnCount = meta.getColumnCount();
    // initial columnTypes
    columnTypes = new Class[columnCount];
    for (int i = 1; i <= columnTypes.length; ++i) {
        columnTypes[i - 1] = TYPE_MAPPING.get(Integer.valueOf(meta
                .getColumnType(i)));
    }
    try {
        cursorName = rs.getCursorName();
    } catch (SQLException e) {
        cursorName = null;
        // ignore
    }

    if (rs.getStatement() != null
            && rs.getStatement().getConnection() != null) {
        setTypeMap(rs.getStatement().getConnection().getTypeMap());
    }

    /*
     * this method not support paging, so before readData set pageSize and
     * maxRowsto 0 and restore previous values after readData
     */
    CachedRowSetReader crsReader = (CachedRowSetReader) syncProvider
            .getRowSetReader();
    crsReader.setResultSet(rs);
    if (!isPaging) {
        int prePageSize = getPageSize();
        setPageSize(0);
        int preMaxRows = getMaxRows();
        setMaxRows(0);
        crsReader.readData(this);
        setPageSize(prePageSize);
        setMaxRows(preMaxRows);
    } else {
        crsReader.readData(this);
    }

    setTableName(rs.getMetaData().getTableName(1));

    originalResultSet = new CachedRowSetImpl();
    crsReader.setResultSet(this);
    crsReader.readData(originalResultSet);
    originalResultSet.setMetaData((RowSetMetaData) (getMetaData()));

    // recovery the states
    beforeFirst();

    isNotifyListener = true;
    if (oldIsNotifyListener) {
        notifyRowSetChanged();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:60,代码来源:CachedRowSetImpl.java

示例11: setMetaData

import javax.sql.RowSetMetaData; //导入依赖的package包/类
public void setMetaData(RowSetMetaData md) throws SQLException {
    meta = md;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:4,代码来源:CachedRowSetImpl.java

示例12: testCopySchema

import javax.sql.RowSetMetaData; //导入依赖的package包/类
public void testCopySchema() throws Exception {
    // the original's addtribute and meta data
    crset.setCommand("testCommand");
    crset.setConcurrency(ResultSet.CONCUR_UPDATABLE);
    crset.setDataSourceName("testDataSource");
    crset.setFetchDirection(ResultSet.FETCH_UNKNOWN);
    crset.setPageSize(20);
    crset.setMaxRows(20);
    crset.setTableName("USER_INFO");
    /*
     * NOTICE: spec say copy must not has any content, but when run on RI,
     * if call next() before call createCopySchema(), the copy can get the
     * current row's data
     */

    /*
     * NOTICE: when run on RI, if add the listener first, then it will go
     * wrong when call createCopySchema().It's said that clone failed.
     */
    // Listener listener = new Listener();
    // crset.addRowSetListener(listener);
    RowSetMetaData rsmd = (RowSetMetaData) crset.getMetaData();
    // the copy
    CachedRowSet crsetCopySchema = crset.createCopySchema();
    RowSetMetaData rsmdCopySchema = (RowSetMetaData) crsetCopySchema
            .getMetaData();

    // compare the meta data between the duplicate and the original
    assertNotSame(crset.getMetaData(), crsetCopySchema.getMetaData());
    assertNotSame(crset.getOriginal(), crsetCopySchema.getOriginal());

    assertEquals("USER_INFO", crset.getTableName());
    assertEquals("USER_INFO", rsmdCopySchema.getTableName(1));
    assertEquals(DEFAULT_COLUMN_COUNT, rsmdCopySchema.getColumnCount());
    assertEquals(rsmd.getColumnName(1), rsmdCopySchema.getColumnName(1));
    // check the primary key
    // TODO: RI doesn't evalute the keyColumns. The value of
    // crset.getKeyColumns() is null.
    if ("true".equals(System.getProperty("Testing Harmony"))) {
        assertNotNull(crset.getKeyColumns());
        assertEquals(0, crset.getKeyColumns().length);
    } else {
        assertNull(crset.getKeyColumns());
    }

    // check the attributes in the duplicate. These are supposed to be the
    // same as the original
    assertFalse(crsetCopySchema.next());
    assertEquals("testCommand", crsetCopySchema.getCommand());
    assertEquals(ResultSet.CONCUR_UPDATABLE, crsetCopySchema
            .getConcurrency());
    assertEquals("testDataSource", crsetCopySchema.getDataSourceName());
    assertEquals(ResultSet.FETCH_UNKNOWN, crsetCopySchema
            .getFetchDirection());
    assertEquals(20, crsetCopySchema.getPageSize());
    assertEquals(20, crsetCopySchema.getMaxRows());

    // fill the duplicate CachedRowSet with data, check the listener
    Listener listener = new Listener();
    crsetCopySchema.addRowSetListener(listener);
    assertNull(listener.getTag());
    rs = st.executeQuery("select * from USER_INFO");
    crsetCopySchema.populate(rs);
    assertEquals("rowSetChanged", listener.getTag());
    listener.clear();
    // the move of the original's cursor shouldn't affect the duplicate
    crset.next();
    assertNull(listener.getTag());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:70,代码来源:CachedRowSetImplTest.java


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