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


Java RowSet.insertRow方法代碼示例

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


在下文中一共展示了RowSet.insertRow方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDataTypesRows

import javax.sql.RowSet; //導入方法依賴的package包/類
protected void createDataTypesRows(RowSet crs) throws SQLException {

        Integer aInteger = 100;
        String aChar = "Oswald Cobblepot";
        Long aLong = Long.MAX_VALUE;
        Short aShort = Short.MAX_VALUE;
        Double aDouble = Double.MAX_VALUE;
        BigDecimal aBigDecimal = BigDecimal.ONE;
        Boolean aBoolean = false;
        Float aFloat = Float.MAX_VALUE;
        Byte aByte = Byte.MAX_VALUE;
        Date aDate = Date.valueOf(LocalDate.now());
        Time aTime = Time.valueOf(LocalTime.now());
        Timestamp aTimeStamp = Timestamp.valueOf(LocalDateTime.now());
        Array aArray = new StubArray("INTEGER", new Object[1]);
        Ref aRef = new SerialRef(new StubRef("INTEGER", query));
        byte[] bytes = new byte[10];
        crs.moveToInsertRow();
        crs.updateInt(1, aInteger);
        crs.updateString(2, aChar);
        crs.updateString(3, aChar);
        crs.updateLong(4, aLong);
        crs.updateBoolean(5, aBoolean);
        crs.updateShort(6, aShort);
        crs.updateDouble(7, aDouble);
        crs.updateBigDecimal(8, aBigDecimal);
        crs.updateFloat(9, aFloat);
        crs.updateByte(10, aByte);
        crs.updateDate(11, aDate);
        crs.updateTime(12, aTime);
        crs.updateTimestamp(13, aTimeStamp);
        crs.updateBytes(14, bytes);
        crs.updateArray(15, aArray);
        crs.updateRef(16, aRef);
        crs.updateDouble(17, aDouble);
        crs.insertRow();
        crs.moveToCurrentRow();

    }
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:40,代碼來源:CommonCachedRowSetTests.java

示例2: commonCachedRowSetTest0006

import javax.sql.RowSet; //導入方法依賴的package包/類
@Test(dataProvider = "rowsetUsingCoffeeHouses")
public void commonCachedRowSetTest0006(RowSet rs) throws Exception {
    TestRowSetListener rsl = new TestRowSetListener();
    rs.addRowSetListener(rsl);
    rs.moveToInsertRow();
    rs.updateInt(1, 10024);
    rs.updateString(2, "Sacramento");
    rs.updateInt(3, 1987);
    rs.updateInt(4, 2341);
    rs.updateInt(5, 4328);
    rs.insertRow();
    assertTrue(rsl.isNotified(TestRowSetListener.ROW_CHANGED));
    rs.close();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:15,代碼來源:CommonCachedRowSetTests.java

示例3: createCoffeesRows

import javax.sql.RowSet; //導入方法依賴的package包/類
protected void createCoffeesRows(RowSet rs) throws SQLException {

        // insert into COFFEES values(1, 'Colombian', 101, 7.99, 0, 0)
        rs.moveToInsertRow();
        rs.updateInt(1, 1);
        rs.updateString(2, "Colombian");
        rs.updateInt(3, 101);
        rs.updateBigDecimal(4, BigDecimal.valueOf(7.99));
        rs.updateInt(5, 0);
        rs.updateInt(6, 0);
        rs.insertRow();
        // insert into COFFEES values(2, 'French_Roast', 49, 8.99, 0, 0)
        rs.moveToInsertRow();
        rs.updateInt(1, 2);
        rs.updateString(2, "French_Roast");
        rs.updateInt(3, 49);
        rs.updateBigDecimal(4, BigDecimal.valueOf(8.99));
        rs.updateInt(5, 0);
        rs.updateInt(6, 0);
        rs.insertRow();
        // insert into COFFEES values(3, 'Espresso', 150, 9.99, 0, 0)
        rs.moveToInsertRow();
        rs.updateInt(1, 3);
        rs.updateString(2, "Espresso");
        rs.updateInt(3, 150);
        rs.updateBigDecimal(4, BigDecimal.valueOf(9.99));
        rs.updateInt(5, 0);
        rs.updateInt(6, 0);
        rs.insertRow();
        // insert into COFFEES values(4, 'Colombian_Decaf', 101, 8.99, 0, 0)
        rs.moveToInsertRow();
        rs.updateInt(1, 4);
        rs.updateString(2, "Colombian_Decaf");
        rs.updateInt(3, 101);
        rs.updateBigDecimal(4, BigDecimal.valueOf(8.99));
        rs.updateInt(5, 0);
        rs.updateInt(6, 0);
        rs.insertRow();
        // insert into COFFEES values(5, 'French_Roast_Decaf', 049, 9.99, 0, 0)
        rs.moveToInsertRow();
        rs.updateInt(1, 5);
        rs.updateString(2, "French_Roast_Decaf");
        rs.updateInt(3, 49);
        rs.updateBigDecimal(4, BigDecimal.valueOf(9.99));
        rs.updateInt(5, 0);
        rs.updateInt(6, 0);
        rs.insertRow();

    }
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:50,代碼來源:CommonRowSetTests.java

示例4: createSuppiersRows

import javax.sql.RowSet; //導入方法依賴的package包/類
protected void createSuppiersRows(RowSet rs) throws SQLException {

        // insert into SUPPLIERS values(49, 'Superior Coffee', '1 Party Place',
        // 'Mendocino', 'CA', '95460')
        rs.moveToInsertRow();
        rs.updateInt(1, 49);
        rs.updateString(2, "Superior Coffee");
        rs.updateString(3, "1 Party Place");
        rs.updateString(4, "Mendocino");
        rs.updateString(5, "CA");
        rs.updateString(6, "95460");
        rs.insertRow();

        // insert into SUPPLIERS values(101, 'Acme, Inc.', '99 Market Street',
        // 'Groundsville', 'CA', '95199')
        rs.moveToInsertRow();
        rs.updateInt(1, 101);
        rs.updateString(2, "Acme, Inc.");
        rs.updateString(3, "99 Market Street");
        rs.updateString(4, "Groundsville");
        rs.updateString(5, "CA");
        rs.updateString(6, "95199");
        rs.insertRow();
        // insert into SUPPLIERS values(150, 'The High Ground',
        // '100 Coffee Lane', 'Meadows', 'CA', '93966')
        rs.moveToInsertRow();
        rs.updateInt(1, 150);
        rs.updateString(2, "The High Ground");
        rs.updateString(3, "100 Coffee Lane");
        rs.updateString(4, "Meadows");
        rs.updateString(5, "CA");
        rs.updateString(6, "93966");
        rs.insertRow();
        // insert into SUPPLIERS values(456," 'Restaurant Supplies, Inc.',
        // '200 Magnolia Street', 'Meadows', 'CA', '93966')
        rs.moveToInsertRow();
        rs.updateInt(1, 456);
        rs.updateString(2, "Restaurant Supplies, Inc.");
        rs.updateString(3, "200 Magnolia Stree");
        rs.updateString(4, "Meadows");
        rs.updateString(5, "CA");
        rs.updateString(6, "93966");
        rs.insertRow();
        // insert into SUPPLIERS values(927, 'Professional Kitchen',
        // '300 Daisy Avenue', 'Groundsville'," 'CA', '95199')
        rs.moveToInsertRow();
        rs.updateInt(1, 927);
        rs.updateString(2, "Professional Kitchen");
        rs.updateString(3, "300 Daisy Avenue");
        rs.updateString(4, "Groundsville");
        rs.updateString(5, "CA");
        rs.updateString(6, "95199");
        rs.insertRow();
    }
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:55,代碼來源:JoinRowSetTests.java


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