Package com.sun.rowset

Examples of com.sun.rowset.CachedRowSetImpl


         connection = dao_.getExoDatasource().getConnection();
         Statement statement =
            connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
         ResultSet resultSet = statement.executeQuery(query);

         CachedRowSet crs = new CachedRowSetImpl();
         crs.setPageSize(pageList.getPageSize());
         crs.populate(resultSet, (pageList.getCurrentPage() - 1) * pageList.getPageSize() + 1);

         while (crs.next())
         {
            T bean = dao_.createInstance();
            dao_.getDBObjectMapper().mapResultSet(crs, bean);
            currentListPage_.add(bean);
         }
View Full Code Here


    public DBDataSet(PreparedStatement pStatement, ResultSet pResults, boolean pAllowOffline) {
        super();
        this.statement = pStatement;
        if (pAllowOffline) {
          try {
            CachedRowSet rowSet = new CachedRowSetImpl();
            rowSet.populate(pResults);
              this.resultSet = rowSet;
          }
          catch (SQLException e) {
                UsageException errorVar = new UsageException(e.getMessage(), SP_ER_USER, SP_ER_PARAMETERERROR, e);
                ErrorMgr.addError(errorVar);
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

    public DBDataSet(PreparedStatement pStatement, ResultSet pResults, boolean pAllowOffline) {
        super();
        this.statement = pStatement;
        if (pAllowOffline) {
          try {
            CachedRowSet rowSet = new CachedRowSetImpl();
            rowSet.populate(pResults);
              this.resultSet = rowSet;
          }
          catch (SQLException e) {
                UsageException errorVar = new UsageException(e.getMessage(), SP_ER_USER, SP_ER_PARAMETERERROR, e);
                ErrorMgr.addError(errorVar);
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

    public DBDataSet(PreparedStatement pStatement, ResultSet pResults, boolean pAllowOffline) {
        super();
        this.statement = pStatement;
        if (pAllowOffline) {
          try {
            CachedRowSet rowSet = new CachedRowSetImpl();
            rowSet.populate(pResults);
              this.resultSet = rowSet;
          }
          catch (SQLException e) {
                UsageException errorVar = new UsageException(e.getMessage(), SP_ER_USER, SP_ER_PARAMETERERROR, e);
                ErrorMgr.addError(errorVar);
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

    if (createCachedRowSet != null) {
      // RowSetProvider.newFactory().createCachedRowSet();
      return (CachedRowSet) ReflectionUtils.invokeJdbcMethod(createCachedRowSet, rowSetFactory);
    }
    else {
      return new CachedRowSetImpl();
    }
  }
View Full Code Here

   * @throws SQLException if thrown by JDBC methods
   * @see #createSqlRowSet
   * @see com.sun.rowset.CachedRowSetImpl
   */
  protected CachedRowSet newCachedRowSet() throws SQLException {
    return new CachedRowSetImpl();
  }
View Full Code Here

    }
  }

  public void testBug49516() throws Exception {

    CachedRowSetImpl crs;

    createTable(
        "bug49516",
        "(`testingID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `firstName` TEXT NOT NULL) CHARACTER SET utf8;");
    this.stmt.executeUpdate("insert into bug49516 set firstName ='John'");

    this.rs = this.stmt
        .executeQuery("select firstName as 'first person' from bug49516");
    this.rs.first();
    assertEquals("John", this.rs.getString("first person"));
    // this.rs.close();
    // this.stmt.close();

    this.rs = this.stmt
        .executeQuery("select firstName as 'first person' from bug49516");

    crs = new CachedRowSetImpl();
    crs.populate(this.rs);
    crs.first();

    assertEquals("John", crs.getString(1));
  }
View Full Code Here

TOP

Related Classes of com.sun.rowset.CachedRowSetImpl

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.