db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: Support for start/stop index in ReportQuery
Date Fri, 14 Nov 2003 16:43:52 GMT
hi Tong-Kiat,

where did you add this support ? could you please attach the patch.
armin and i are currently looking into a solution to support sql limits, 
so this could make the ojb way of paging obsolete.

greetings to singapore
jakob

Chiah Tong Kiat wrote:
> 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();
> 
> <     }
> 
> <
> 
> 


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