javax.sql.RowSet Java Examples
The following examples show how to use
javax.sql.RowSet.
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: CommonCachedRowSetTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "rowsetUsingCoffeeHouses") public void commonCachedRowSetTest0007(RowSet rs) throws Exception { TestRowSetListener rsl = new TestRowSetListener(); TestRowSetListener rsl2 = new TestRowSetListener(); rs.addRowSetListener(rsl); rs.addRowSetListener(rsl2); rs.first(); rs.updateInt(1, 1961); rs.updateString(2, "Pittsburgh"); rs.updateInt(3, 1987); rs.updateInt(4, 2341); rs.updateInt(5, 6689); rs.updateRow(); assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROW_CHANGED)); assertTrue(rsl2.isNotified(TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROW_CHANGED)); rs.close(); }
Example #2
Source File: CommonCachedRowSetTests.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "rowsetUsingCoffeeHouses") public void commonCachedRowSetTest0042(RowSet rs) throws Exception { assertFalse(rs.isBeforeFirst()); assertFalse(rs.isFirst()); rs.beforeFirst(); assertTrue(rs.isBeforeFirst()); assertFalse(rs.isFirst()); rs.next(); assertFalse(rs.isBeforeFirst()); assertTrue(rs.isFirst()); rs.next(); assertFalse(rs.isBeforeFirst()); assertFalse(rs.isFirst()); rs.first(); assertFalse(rs.isBeforeFirst()); assertTrue(rs.isFirst()); rs.close(); }
Example #3
Source File: PrimaryKeyFilter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public boolean evaluate(RowSet rs) { boolean result = false; try { int columnValue = -1; if (this.colNumber > 0) { columnValue = rs.getInt(this.colNumber); } else if (this.colName != null) { columnValue = rs.getInt(this.colName); } if ((columnValue >= this.lo) && (columnValue <= this.hi)) { result = true; } } catch (Exception e) { System.out.println("Error:" + e.getMessage()); result = false; } return result; }
Example #4
Source File: CommonCachedRowSetTests.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test(dataProvider = "rowsetUsingCoffeeHouses") public void commonCachedRowSetTest0007(RowSet rs) throws Exception { TestRowSetListener rsl = new TestRowSetListener(); TestRowSetListener rsl2 = new TestRowSetListener(); rs.addRowSetListener(rsl); rs.addRowSetListener(rsl2); rs.first(); rs.updateInt(1, 1961); rs.updateString(2, "Pittsburgh"); rs.updateInt(3, 1987); rs.updateInt(4, 2341); rs.updateInt(5, 6689); rs.updateRow(); assertTrue(rsl.isNotified(TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROW_CHANGED)); assertTrue(rsl2.isNotified(TestRowSetListener.CURSOR_MOVED | TestRowSetListener.ROW_CHANGED)); rs.close(); }
Example #5
Source File: CommonRowSetTests.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "rowSetType") public void commonRowSetTest0022(RowSet rs) throws Exception { Map<String, Class<?>> map = new HashMap<>(); map.put("SUPERHERO", Class.forName("util.SuperHero")); rs.setTypeMap(map); assertTrue(rs.getTypeMap().equals(map)); }
Example #6
Source File: CommonCachedRowSetTests.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
protected <T extends RowSet> T createDataTypesRowSet() throws SQLException { T rs = (T) newInstance(); initDataTypesMetaData((CachedRowSet) rs); createDataTypesRows(rs); // Make sure you are not on the insertRow rs.moveToCurrentRow(); return rs; }
Example #7
Source File: CommonRowSetTests.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetTrueFalse") protected Object[][] rowSetTrueFalse() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, true}, {rs, false} }; }
Example #8
Source File: CommonRowSetTests.java From hottub with GNU General Public License v2.0 | 5 votes |
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 #9
Source File: CommonRowSetTests.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetScrollTypes") protected Object[][] rowSetScrollTypes() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, ResultSet.TYPE_FORWARD_ONLY}, {rs, ResultSet.TYPE_SCROLL_INSENSITIVE}, {rs, ResultSet.TYPE_SCROLL_SENSITIVE} }; }
Example #10
Source File: CommonCachedRowSetTests.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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(); }
Example #11
Source File: CommonRowSetTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "rowSetType") public void commonRowSetTest0022(RowSet rs) throws Exception { Map<String, Class<?>> map = new HashMap<>(); map.put("SUPERHERO", Class.forName("util.SuperHero")); rs.setTypeMap(map); assertTrue(rs.getTypeMap().equals(map)); }
Example #12
Source File: JdbcRowSetAccessor.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { //super.readExternal(in); connectionManager = (String)in.readObject(); connectionName = (String)in.readObject(); connectionUrl = (String)in.readObject(); query = (String)in.readObject(); rowSet = (RowSet)in.readObject(); parameters = (List<Object>)in.readObject(); }
Example #13
Source File: CommonCachedRowSetTests.java From hottub with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowsetUsingCoffees") protected Object[][] rowsetUsingCoffees() throws Exception { RowSet rs = createCoffeesRowSet(); return new Object[][]{ {rs} }; }
Example #14
Source File: CommonCachedRowSetTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected <T extends RowSet> T createDataTypesRowSet() throws SQLException { T rs = (T) newInstance(); initDataTypesMetaData((CachedRowSet) rs); createDataTypesRows(rs); // Make sure you are not on the insertRow rs.moveToCurrentRow(); return rs; }
Example #15
Source File: CityFilter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public boolean evaluate(RowSet rs) { boolean result = false; if (rs == null) { return false; } try { for (String city : cities) { String val = ""; if (colNumber > 0) { val = (String) rs.getObject(colNumber); } else if (colName != null) { val = (String) rs.getObject(colName); } if (val.equalsIgnoreCase(city)) { return true; } } } catch (SQLException e) { result = false; } return result; }
Example #16
Source File: CommonRowSetTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetConcurrencyTypes") protected Object[][] rowSetConcurrencyTypes() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, ResultSet.CONCUR_READ_ONLY}, {rs, ResultSet.CONCUR_UPDATABLE} }; }
Example #17
Source File: CommonCachedRowSetTests.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@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(); }
Example #18
Source File: CityFilter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public boolean evaluate(RowSet rs) { boolean result = false; if (rs == null) { return false; } try { for (String city : cities) { String val = ""; if (colNumber > 0) { val = (String) rs.getObject(colNumber); } else if (colName != null) { val = (String) rs.getObject(colName); } if (val.equalsIgnoreCase(city)) { return true; } } } catch (SQLException e) { result = false; } return result; }
Example #19
Source File: CommonRowSetTests.java From hottub with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "rowSetTrueFalse") protected Object[][] rowSetTrueFalse() throws Exception { RowSet rs = newInstance(); return new Object[][]{ {rs, true}, {rs, false} }; }
Example #20
Source File: CommonRowSetTests.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0114(RowSet rs) throws Exception { Reader rdr = null; rs.setCharacterStream("one", rdr, query.length()); }
Example #21
Source File: CommonRowSetTests.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0120(RowSet rs) throws Exception { rs.setClob("one", new StubClob()); }
Example #22
Source File: CommonRowSetTests.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0106(RowSet rs) throws Exception { rs.setBigDecimal("one", BigDecimal.ONE); }
Example #23
Source File: CommonRowSetTests.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0102(RowSet rs) throws Exception { InputStream is = null; rs.setAsciiStream("one", is, query.length()); }
Example #24
Source File: CommonRowSetTests.java From hottub with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType") public void commonRowSetTest0025(RowSet rs) throws Exception { int timeout = 0; rs.setQueryTimeout(timeout); assertTrue(rs.getQueryTimeout() == timeout); }
Example #25
Source File: CommonRowSetTests.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0103(RowSet rs) throws Exception { InputStream is = null; rs.setBinaryStream(1, is); }
Example #26
Source File: CommonRowSetTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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(); }
Example #27
Source File: StubJoinRowSetImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void addRowSet(RowSet rowset, int columnIdx) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
Example #28
Source File: CommonRowSetTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0118(RowSet rs) throws Exception { Reader rdr = null; rs.setClob("one", rdr); }
Example #29
Source File: CommonRowSetTests.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0148(RowSet rs) throws Exception { rs.setSQLXML("one", new StubSQLXML()); }
Example #30
Source File: CommonRowSetTests.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Test(dataProvider = "rowSetType", expectedExceptions = SQLFeatureNotSupportedException.class) public void commonRowSetTest0122(RowSet rs) throws Exception { rs.setDate("one", Date.valueOf(LocalDate.now()), Calendar.getInstance()); }