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


Java RowSetMetaDataImpl.setColumnType方法代码示例

本文整理汇总了Java中javax.sql.rowset.RowSetMetaDataImpl.setColumnType方法的典型用法代码示例。如果您正苦于以下问题:Java RowSetMetaDataImpl.setColumnType方法的具体用法?Java RowSetMetaDataImpl.setColumnType怎么用?Java RowSetMetaDataImpl.setColumnType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sql.rowset.RowSetMetaDataImpl的用法示例。


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

示例1: 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;
  }
 
开发者ID:assis,项目名称:ParGRES,代码行数:25,代码来源:ClusterQueryProcessorEngine.java

示例2: 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;
}
 
开发者ID:assis,项目名称:ParGRES,代码行数:24,代码来源:ConnectionManagerImpl.java

示例3: 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);

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:29,代码来源:CommonRowSetTests.java

示例4: 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);

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:CommonRowSetTests.java

示例5: 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);

}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:CommonCachedRowSetTests.java

示例6: 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);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:31,代码来源:JoinRowSetTests.java

示例7: 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();
}
 
开发者ID:assis,项目名称:ParGRES,代码行数:13,代码来源:HelloRowSet.java

示例8: 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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:RowSetMetaDataImplTest.java

示例9: 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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:RowSetMetaDataImplTest.java

示例10: initMetaData

import javax.sql.rowset.RowSetMetaDataImpl; //导入方法依赖的package包/类
/**
 * Initializes the given <code>RowSetMetaData</code> object with the values
 * in the given <code>ResultSetMetaData</code> object.
 * 
 * @param md
 *            the <code>RowSetMetaData</code> object for this
 *            <code>CachedRowSetImpl</code> object, which will be set with
 *            values from rsmd
 * @param rsmd
 *            the <code>ResultSetMetaData</code> object from which new
 *            values for md will be read
 * @throws SQLException
 *             if an error occurs
 */
private void initMetaData(RowSetMetaDataImpl md, ResultSetMetaData rsmd) throws SQLException {
	int numCols = rsmd.getColumnCount();

	md.setColumnCount(numCols);
	boolean isCaseSensitive = numCols > 0 ? rsmd.isCaseSensitive(1) : false;
	for (int col = 1; col <= numCols; col++) {
		md.setAutoIncrement(col, rsmd.isAutoIncrement(col));
		md.setCaseSensitive(col, isCaseSensitive); // fix the MySQL
													// performance
													// issue:http://blog.csdn.net/match_ding/article/details/11078553
		md.setCurrency(col, rsmd.isCurrency(col));
		md.setNullable(col, rsmd.isNullable(col));
		md.setSigned(col, rsmd.isSigned(col));
		md.setSearchable(col, rsmd.isSearchable(col));
		/*
		 * The PostgreSQL drivers sometimes return negative
		 * columnDisplaySize, which causes an exception to be thrown. Check
		 * for it.
		 */
		int size = rsmd.getColumnDisplaySize(col);
		if (size < 0) {
			size = 0;
		}
		md.setColumnDisplaySize(col, size);
		md.setColumnLabel(col, rsmd.getColumnLabel(col));
		md.setColumnName(col, rsmd.getColumnName(col));
		md.setSchemaName(col, rsmd.getSchemaName(col));
		/*
		 * Drivers return some strange values for precision, for non-numeric
		 * data, including reports of non-integer values; maybe we should
		 * check type, & set to 0 for non-numeric types.
		 */
		int precision = rsmd.getPrecision(col);
		if (precision < 0) {
			precision = 0;
		}
		md.setPrecision(col, precision);

		/*
		 * It seems, from a bug report, that a driver can sometimes return a
		 * negative value for scale. javax.sql.rowset.RowSetMetaDataImpl
		 * will throw an exception if we attempt to set a negative value. As
		 * such, we'll check for this case.
		 */
		int scale = rsmd.getScale(col);
		if (scale < 0) {
			scale = 0;
		}
		md.setScale(col, scale);
		md.setTableName(col, rsmd.getTableName(col));
		md.setCatalogName(col, rsmd.getCatalogName(col));
		md.setColumnType(col, rsmd.getColumnType(col));
		md.setColumnTypeName(col, rsmd.getColumnTypeName(col));
	}
}
 
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:70,代码来源:CachedRowSetImpl.java


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