當前位置: 首頁>>代碼示例>>Java>>正文


Java CachedRowSet.setMetaData方法代碼示例

本文整理匯總了Java中javax.sql.rowset.CachedRowSet.setMetaData方法的典型用法代碼示例。如果您正苦於以下問題:Java CachedRowSet.setMetaData方法的具體用法?Java CachedRowSet.setMetaData怎麽用?Java CachedRowSet.setMetaData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.sql.rowset.CachedRowSet的用法示例。


在下文中一共展示了CachedRowSet.setMetaData方法的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: initDataTypesMetaData

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

示例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.setMetaData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。