You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Chiah Tong Kiat <ct...@silicomp.com.sg> on 2003/11/14 02:45:31 UTC
Support for start/stop index in ReportQuery
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();
< }
<
OQL Request
Posted by Brian McCallister <mc...@forthillcompany.com>.
Now that we have anonymous keys it would be awfully nice to support
automagic pk de-referencing if you have a query like:
Query q = Query.create("select articles from " +
Article.class.getName() + " where productGroup = $1");
q.bind(aProductGroup);
Any thoughts?
-Brian
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: Support for start/stop index in ReportQuery
Posted by Jakob Braeuchi <jb...@gmx.ch>.
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