Java Code Examples for javax.sql.rowset.CachedRowSet#setMetaData()

The following examples show how to use javax.sql.rowset.CachedRowSet#setMetaData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JoinRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: JoinRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: JoinRowSetTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: CommonRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 5
Source File: CommonRowSetTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 6
Source File: CommonCachedRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 7
Source File: CommonCachedRowSetTests.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 8
Source File: CommonCachedRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 9
Source File: CommonCachedRowSetTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 10
Source File: CommonRowSetTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 11
Source File: CommonRowSetTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 12
Source File: CommonRowSetTests.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 13
Source File: CommonRowSetTests.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 14
Source File: JoinRowSetTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 15
Source File: CommonRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 16
Source File: JoinRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 17
Source File: CommonRowSetTests.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 18
Source File: JoinRowSetTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);
}
 
Example 19
Source File: CommonCachedRowSetTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);

}
 
Example 20
Source File: CommonRowSetTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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);

}