db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer PagingIterator.java
Date Thu, 20 Nov 2003 19:31:08 GMT
brj         2003/11/20 11:31:08

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        PagingIterator.java
  Log:
  - releaseDbResources when iterator echausted
  - check indices
  
  Revision  Changes    Path
  1.2       +20 -3     db-ojb/src/java/org/apache/ojb/broker/accesslayer/PagingIterator.java
  
  Index: PagingIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/PagingIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PagingIterator.java	19 Nov 2003 21:13:31 -0000	1.1
  +++ PagingIterator.java	20 Nov 2003 19:31:08 -0000	1.2
  @@ -59,7 +59,10 @@
   
   /**
    * PagingIterator is wrapper around an OJBIterator to support 
  - * startAt endAt positions. 
  + * startAt endAt positions. The PagingIterator returns rows including startAt
  + * and including endAt.
  + * 
  + * startAt = 1, endAt = 11 returns rows 1 to 11 if available
    *
    * @author <a href="mailto:jbraeuchi@gmx.ch">Jakob Braeuchi</a>
    * @version $Id$
  @@ -81,6 +84,11 @@
       {
           super();
           
  +        if (startAt > endAt)
  +        {
  +            throw new PersistenceBrokerException("startAt must be less than endAt.");
  +        }
  +        
           m_iterator = anIterator;
           m_fullSize = m_iterator.size();
           
  @@ -144,7 +152,16 @@
        */
       public boolean hasNext()
       {
  -        return m_currentCursorPosition < m_endAt;
  +        if (m_currentCursorPosition < m_endAt)
  +        {
  +            return true;
  +        }
  +        else
  +        {
  +            releaseDbResources();
  +            return false;
  +        }
  +            
       }
   
       /* (non-Javadoc)
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message