本文整理匯總了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);
}
示例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);
}
示例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();
}
示例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);
}