use of javax.sql.rowset.RowSetMetaDataImpl in project jdk8u_jdk by JetBrains.
the class CommonRowSetTests method initCoffeeHousesMetaData.
/*
* Initializes the COFFEE_HOUSES metadata
*/
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);
}
use of javax.sql.rowset.RowSetMetaDataImpl in project jdk8u_jdk by JetBrains.
the class CommonRowSetTests method initCoffeesMetaData.
/*
* Initializes the COFFEES metadata
*/
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);
}
use of javax.sql.rowset.RowSetMetaDataImpl in project jdk8u_jdk by JetBrains.
the class RowSetMetaDataTests method test99.
/*
* Validate isWrapperFor and unwrap work correctly
*/
@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()));
}
use of javax.sql.rowset.RowSetMetaDataImpl in project jdk8u_jdk by JetBrains.
the class RowSetMetaDataTests method setUpMethod.
@BeforeMethod
public void setUpMethod() throws Exception {
rsmd = new RowSetMetaDataImpl();
rsmd.setColumnCount(MAX_COLUMNS);
}
use of javax.sql.rowset.RowSetMetaDataImpl in project jdk8u_jdk by JetBrains.
the class CommonCachedRowSetTests method initDataTypesMetaData.
/*
* Initializes the DATAYPES table metadata
*/
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);
}
Aggregations