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


Java CachedRowSet.setTableName方法代码示例

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


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

示例1: initCoffeeHousesMetaData

import javax.sql.rowset.CachedRowSet; //导入方法依赖的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

示例2: initCoffeesMetaData

import javax.sql.rowset.CachedRowSet; //导入方法依赖的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

示例3: commonCachedRowSetTest0010

import javax.sql.rowset.CachedRowSet; //导入方法依赖的package包/类
@Test(dataProvider = "rowSetType")
public void commonCachedRowSetTest0010(CachedRowSet rs) throws Exception {
    assertNull(rs.getTableName());
    rs.setTableName(COFFEE_HOUSES_TABLE);
    assertTrue(rs.getTableName().equals(COFFEE_HOUSES_TABLE));
    rs.close();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:CommonCachedRowSetTests.java

示例4: initSuppliersMetaData

import javax.sql.rowset.CachedRowSet; //导入方法依赖的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


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