Package javax.sql.rowset

Examples of javax.sql.rowset.CachedRowSet


        assertEquals(4, rowNum);
    }

    public void testJoin_Delete2() throws Exception {
        rs = st.executeQuery("select * from BOOKS");
        CachedRowSet crset2 = newNoInitialInstance();
        crset2.populate(rs);

       crset.absolute(3);
        crset.deleteRow();
        crset.setShowDeleted(true);

        jrs.addRowSet(crset, 1);
        jrs.first();
        jrs.deleteRow();
       
        int rowNum = 0;
        jrs.beforeFirst();
        while (jrs.next()) {
            rowNum++;
        }
        assertEquals(4, rowNum);

        jrs.setShowDeleted(true);

        rowNum = 0;
        jrs.beforeFirst();
        while (jrs.next()) {
            rowNum++;
        }
        assertEquals(4, rowNum);

       
        jrs.beforeFirst();
        while (jrs.next()) {
            if (jrs.getInt(1) == 3) {
                assertTrue(jrs.rowDeleted());
            }
        }

        crset2.absolute(6);
        crset2.deleteRow();

        crset2.beforeFirst();
        while (crset2.next()) {
            if (crset2.getInt(1) == 4) {
                assertTrue(crset2.rowDeleted());
            }
        }

        jrs.addRowSet(crset2, 1);

View Full Code Here


    }

    public void testProperty_TwoRowSets() throws Exception {
        jrs.addRowSet(crset, 1);
        rs = st.executeQuery("select * from BOOKS");
        CachedRowSet crset2 = newNoInitialInstance();
        crset2.populate(rs);
        crset2.setDataSourceName("testDataSourceName");
        jrs.addRowSet(crset2, 1);

        assertEquals(crset2.getTypeMap(), jrs.getTypeMap());
        assertEquals(crset.getTypeMap(), crset2.getTypeMap());
    }
View Full Code Here

        while (jrs.next()) {
            rowNum++;
        }
        assertEquals(3, rowNum);

        CachedRowSet crset2 = newNoInitialInstance();
        rs = st.executeQuery("select * from books");
        crset2.populate(rs);

        crset2.absolute(3);
        crset2.deleteRow();

        jrs.addRowSet(crset2, 1);

        rowNum = 0;
        jrs.beforeFirst();
View Full Code Here

        else {
        assertFalse(jrs.getShowDeleted());
        }
        assertEquals(4, rowNum);

        CachedRowSet crset2 = newNoInitialInstance();
        rs = st.executeQuery("select * from books");
        crset2.populate(rs);

        crset2.absolute(3);
        crset2.deleteRow();
        crset2.setShowDeleted(true);

        jrs.addRowSet(crset2, 1);

        rowNum = 0;
        jrs.beforeFirst();
View Full Code Here

            }
        }
        assertEquals(4, rowNum);
        assertTrue(jrs.getShowDeleted());

        CachedRowSet crset2 = newNoInitialInstance();
        rs = st.executeQuery("select * from books");
        crset2.populate(rs);

        crset2.absolute(3);
        crset2.deleteRow();
        crset2.setShowDeleted(true);

        jrs.addRowSet(crset2, 1);
        jrs.setShowDeleted(false);

        rowNum = 0;
View Full Code Here

        assertTrue(crset.isFirst());
        assertFalse(jrs.isFirst());
    }
   
    public void testJoin_OrignalShowDeleted3() throws Exception {
        CachedRowSet crset2 = newNoInitialInstance();
        rs = st.executeQuery("select * from books");
        crset2.populate(rs);
       
        jrs.addRowSet(crset, 1);
        jrs.first();
        jrs.deleteRow();
       
        int rowNum = 0;
        jrs.beforeFirst();
        while (jrs.next()) {
            rowNum++;
        }
        assertEquals(3, rowNum);
       
        crset2.setShowDeleted(true);
        jrs.addRowSet(crset2, 1);
        rowNum = 0;
        jrs.beforeFirst();
        while (jrs.next()) {
            rowNum++;
View Full Code Here

  private void populateResults(PreparedStatement ps, ResultSet rs) throws SQLException {
    if (rs == null) {
      resultSet = null;
    }
    else {
      CachedRowSet rowSet = new CachedRowSetImpl();
      final ResultSetMetaData md = new DelegatingResultSetMetaData(rs.getMetaData()) {
        @Override
        public int getScale(int column) throws SQLException {
          int result = super.getScale(column);
          if (result < 0) {
            result = 0;
          }
          return result;
       
      };
     
      ResultSet rsNew = new DelegatingResultSet(rs) {
        @Override
        public ResultSetMetaData getMetaData() throws SQLException {
          return md;
        }
      };
     
      rowSet.populate(rsNew);
      resultSet = rowSet;
     
      this.resultSetType = rs.getType();
      this.resultSetConcurrency = rs.getConcurrency();
    }
View Full Code Here

          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateDouble(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), net.helipilot50.stocktrade.framework.Constants.SP_ER_USER, net.helipilot50.stocktrade.framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here

          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateLong(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), net.helipilot50.stocktrade.framework.Constants.SP_ER_USER, net.helipilot50.stocktrade.framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here

          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
        if (resultSet instanceof CachedRowSet) {
          CachedRowSet cachedRowSet = (CachedRowSet) resultSet;
          try {
            cachedRowSet.updateBoolean(pColOrdinal, pValue);
          } catch (SQLException e) {
            UsageException errorVar = new UsageException(e.getMessage(), net.helipilot50.stocktrade.framework.Constants.SP_ER_USER, net.helipilot50.stocktrade.framework.Constants.SP_ER_PARAMETERERROR, e);
            ErrorMgr.addError(errorVar);
            throw errorVar;
          }
View Full Code Here

TOP

Related Classes of javax.sql.rowset.CachedRowSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.