db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chiah Tong Kiat" <...@silicomp.com.sg>
Subject Support for start/stop index in ReportQuery
Date Fri, 14 Nov 2003 01:45:31 GMT
Hi All

 

I've made a small patch in the PersistenceBrokerImpl.java to add support for
start/stop index for ReportQuery.  Could any have a look it?

 

Thanks

Tong-Kiat

 

2493,2496d2492

 

<         int startAt = query.getStartAtIndex();

<         int endAt = query.getEndAtIndex();

<         if
((startAt==Query.NO_START_AT_INDEX)&&(endAt==Query.NO_END_AT_INDEX))

<         {

2500,2533d2495

 

<         OJBIterator iter = getReportQueryIteratorFromQuery(query, cld);

<         ArrayList array = new ArrayList();

<         int numberOfObjectsToFetch = endAt - startAt;        

<         int retrievedCount = 0;

< 

<         if (startAt > 1)

<         {

<             // needs to be just before startAt, as next() is called for
first result.

<             iter.absolute(startAt - 1);

<         }

<         if (endAt < startAt)

<         {

<             // BRJ : make sure endAt > startAt

<             endAt = iter.size() + 1;

<         }

<         

<         try

<         {

<             while (((endAt == Query.NO_END_AT_INDEX) || (retrievedCount <
numberOfObjectsToFetch)) && iter.hasNext())

<             {

<                 array.add(iter.next());

<                 retrievedCount++;

<             }

<         }

<         finally

<         {

<             if (iter != null)

<             {

<                 iter.releaseDbResources();

<             }

<         }

<         return array.iterator();

<     }

<


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message