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 OJBIterator.java PagingIterator.java RsIterator.java ChainingIterator.java
Date Wed, 17 Dec 2003 20:36:22 GMT
brj         2003/12/17 12:36:22

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_BRANCH_1_0 OJBIterator.java PagingIterator.java
                        RsIterator.java ChainingIterator.java
  Log:
  - changed signature of relative() to throw PersistenceBrokerException
  - fixed problems with PagingIterator
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.5.2.1   +4 -5      db-ojb/src/java/org/apache/ojb/broker/accesslayer/OJBIterator.java
  
  Index: OJBIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/OJBIterator.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- OJBIterator.java	8 Dec 2003 17:46:10 -0000	1.5
  +++ OJBIterator.java	17 Dec 2003 20:36:22 -0000	1.5.2.1
  @@ -54,10 +54,9 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.PersistenceBrokerException;
  -
   import java.util.Iterator;
  -import java.sql.SQLException;
  +
  +import org.apache.ojb.broker.PersistenceBrokerException;
   
   /**
    * @version $Id$
  @@ -89,7 +88,7 @@
        * but does not change the cursor position.
        * @param row the row to move to in this iterator, by relative number
        */
  -    boolean relative(int row) throws SQLException;
  +    boolean relative(int row) throws PersistenceBrokerException;
   	
       /**
        * Release all internally used Database resources of the iterator.
  
  
  
  1.6.2.1   +22 -11    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.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- PagingIterator.java	8 Dec 2003 17:46:10 -0000	1.6
  +++ PagingIterator.java	17 Dec 2003 20:36:22 -0000	1.6.2.1
  @@ -43,8 +43,6 @@
    * Apache Software Foundation, please see <http://www.apache.org/> .
    */
   
  -import java.sql.SQLException;
  -
   import org.apache.ojb.broker.PersistenceBrokerException;
   import org.apache.ojb.broker.query.Query;
   
  @@ -143,19 +141,32 @@
   	 */
       public boolean absolute(int row) throws PersistenceBrokerException
       {
  -        return m_iterator.absolute(m_startAt + row);
  +        int newPosition = m_startAt - 1 + row;
  +        
  +        if (newPosition < m_startAt)
  +        {
  +            newPosition = Math.max(m_endAt + row, m_startAt - 1);
  +        }
  +        
  +        if (newPosition > m_endAt)
  +        {
  +            newPosition = m_endAt;
  +        }
  +        
  +        m_currentCursorPosition = newPosition;
  +        return m_iterator.absolute(newPosition);
       }
   
       /*
  -	 * (non-Javadoc)
  -	 * 
  -	 * @see org.apache.ojb.broker.accesslayer.OJBIterator#relative(int)
  -	 */
  -    public boolean relative(int row) throws SQLException
  +     * (non-Javadoc)
  +     * 
  +     * @see org.apache.ojb.broker.accesslayer.OJBIterator#relative(int)
  +     */
  +    public boolean relative(int row) throws PersistenceBrokerException
       {
  -        return m_iterator.relative(row);
  +        return absolute(m_currentCursorPosition + row);
       }
  -
  +    
       /*
   	 * (non-Javadoc)
   	 * 
  
  
  
  1.54.2.1  +2 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
  
  Index: RsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java,v
  retrieving revision 1.54
  retrieving revision 1.54.2.1
  diff -u -r1.54 -r1.54.2.1
  --- RsIterator.java	13 Dec 2003 17:50:40 -0000	1.54
  +++ RsIterator.java	17 Dec 2003 20:36:22 -0000	1.54.2.1
  @@ -739,7 +739,7 @@
        * @param row
        *            the row to move to in this iterator, by relative number
        */
  -    public boolean relative(int row) throws SQLException
  +    public boolean relative(int row) throws PersistenceBrokerException
       {
           boolean retval = false;
           if (supportsAdvancedJDBCCursorControl())
  
  
  
  1.8.2.1   +2 -3      db-ojb/src/java/org/apache/ojb/broker/accesslayer/ChainingIterator.java
  
  Index: ChainingIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/ChainingIterator.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- ChainingIterator.java	8 Dec 2003 17:46:10 -0000	1.8
  +++ ChainingIterator.java	17 Dec 2003 20:36:22 -0000	1.8.2.1
  @@ -53,7 +53,6 @@
    */
   package org.apache.ojb.broker.accesslayer;
   
  -import java.sql.SQLException;
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  @@ -272,7 +271,7 @@
   	 * positioned before the first row or after the last row of 
   	 * the result set.
   	 */
  -	public boolean relative(int row) throws SQLException
  +	public boolean relative(int row) throws PersistenceBrokerException
   	{
   		if (row == 0)
   		{
  
  
  

---------------------------------------------------------------------
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