jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morg...@apache.org
Subject cvs commit: jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/statement StatementImplTag.java StatementTag.java RowCountTag.java WasEmptyTag.java WasNotEmptyTag.java
Date Wed, 15 Aug 2001 00:45:25 GMT
morgand     01/08/14 17:45:25

  Modified:    dbtags/src/org/apache/taglibs/dbtags/preparedstatement
                        PreparedStatementImplTag.java
               dbtags/src/org/apache/taglibs/dbtags/resultset
                        ResultSetTag.java
               dbtags/src/org/apache/taglibs/dbtags/statement
                        StatementImplTag.java StatementTag.java
  Removed:     dbtags/src/org/apache/taglibs/dbtags/statement
                        RowCountTag.java WasEmptyTag.java
                        WasNotEmptyTag.java
  Log:
  rowCount, wasEmpty and wasNotEmpty can be used outside of statement tags
  
  Revision  Changes    Path
  1.8       +0 -9      jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/preparedstatement/PreparedStatementImplTag.java
  
  Index: PreparedStatementImplTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/preparedstatement/PreparedStatementImplTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PreparedStatementImplTag.java	2001/08/09 16:07:20	1.7
  +++ PreparedStatementImplTag.java	2001/08/15 00:45:25	1.8
  @@ -103,7 +103,6 @@
   
     private String _connId               = null;
     private PreparedStatement _statement = null;
  -  private int _rowCount = -1;
   
     public void setQuery(String query) throws SQLException, JspTagException {
       Connection conn = (Connection)pageContext.findAttribute(_connId);
  @@ -146,14 +145,6 @@
   
     public ResultSet executeQuery() throws SQLException {
       return _statement.executeQuery();
  -  }
  -
  -  public int getTotalRowCount() {
  -    return _rowCount;
  -  }
  -
  -  public void setTotalRowCount(int rowCount) {
  -    _rowCount = rowCount;
     }
   
     public int doStartTag() throws JspTagException {
  
  
  
  1.7       +10 -16    jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/resultset/ResultSetTag.java
  
  Index: ResultSetTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/resultset/ResultSetTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ResultSetTag.java	2001/08/09 21:58:30	1.6
  +++ ResultSetTag.java	2001/08/15 00:45:25	1.7
  @@ -128,9 +128,7 @@
     private String _name = null;
     private String _scope = null;
     private int _rowCount = 0;
  -  private StatementTag _stmtTag = null;
   
  -
     /**
      * Locate and return the specified bean, from an optionally specified
      * scope, in the specified page context.  If no such bean is found,
  @@ -198,7 +196,7 @@
             _rset = (ResultSet) lookup(pageContext, _name, _scope);
           }
           else {
  -            _stmtTag =
  +            StatementTag _stmtTag =
                   (StatementTag) findAncestorWithClass(this,
                       Class.forName("org.apache.taglibs.dbtags.statement.StatementTag"));
               _rset = _stmtTag.executeQuery();
  @@ -211,16 +209,12 @@
           }
   
           if (_rset.next() == false) {
  -          if (_stmtTag!=null) {
  -              _stmtTag.setTotalRowCount(_rowCount);
  -          }
  +          setTotalRowCount(_rowCount);
             return SKIP_BODY;
           }
   
         ++_rowCount;
  -      if (_stmtTag!=null) {
  -          _stmtTag.setTotalRowCount(_rowCount);
  -      }
  +      setTotalRowCount(_rowCount);
   
       } catch (ClassNotFoundException e) {
         throw new JspTagException(e.toString());
  @@ -265,18 +259,14 @@
       try {
         if (_rset.next() == true) {
           ++_rowCount;
  -        if (_stmtTag!=null) {
  -            _stmtTag.setTotalRowCount(_rowCount);
  -        }
  +        setTotalRowCount(_rowCount);
           return EVAL_BODY_TAG;
         }
       } catch (SQLException e) {
         throw new JspTagException(e.toString());
       }
   
  -    if (_stmtTag!=null) {
  -        _stmtTag.setTotalRowCount(_rowCount);
  -    }
  +    setTotalRowCount(_rowCount);
       return EVAL_PAGE;
     }
   
  @@ -287,7 +277,11 @@
       _name = null;
       _scope = null;
       _rowCount = 0;
  -    _stmtTag = null;
  +  }
  +
  +  protected void setTotalRowCount(int rowCount) {
  +    pageContext.setAttribute("org.apache.taglibs.dbtags.resultset.rowcount",
  +                              new Integer(rowCount));
     }
   
   }
  
  
  
  1.9       +0 -9      jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/statement/StatementImplTag.java
  
  Index: StatementImplTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/statement/StatementImplTag.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StatementImplTag.java	2001/08/09 16:07:20	1.8
  +++ StatementImplTag.java	2001/08/15 00:45:25	1.9
  @@ -98,7 +98,6 @@
     private Statement _statement = null;
     private String _query        = null;
     private String _connId       = null;
  -  private int _rowCount = -1;
   
     // all the public methods are Javadoced
     // in their interfaces
  @@ -117,14 +116,6 @@
   
     public ResultSet executeQuery() throws SQLException {
       return _statement.executeQuery(_query);
  -  }
  -
  -  public int getTotalRowCount() {
  -    return _rowCount;
  -  }
  -
  -  public void setTotalRowCount(int rowCount) {
  -    _rowCount = rowCount;
     }
   
     public int doStartTag() throws JspTagException {
  
  
  
  1.7       +0 -16     jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/statement/StatementTag.java
  
  Index: StatementTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/dbtags/src/org/apache/taglibs/dbtags/statement/StatementTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StatementTag.java	2001/07/02 18:19:46	1.6
  +++ StatementTag.java	2001/08/15 00:45:25	1.7
  @@ -108,21 +108,5 @@
      */
     public ResultSet executeQuery() throws SQLException;
   
  -  /**
  -   * Get the total number of rows returned by the previous
  -   * ResultSet
  -   * 
  -   * @return count of rows in the previous ResultSet, or -1
  -   *         if no ResultSet has been retrieved
  -   */
  -  public int getTotalRowCount();
  -
  -  /**
  -   * Allows an enclosed ResultSet tag to indicate
  -   * how many rows it retrieved
  -   * 
  -   * @param rowCount number of rows retrieved
  -   */
  -  public void setTotalRowCount(int rowCount);
     
   }
  
  
  

Mime
View raw message