Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Help with IQueryResult and setting limits

I "inherited" some code and in reviewing it, I ended up with a question I was hoping someone could assist me with.

IQueryResult results = getQueryClient().getResolvedQueryResults(query, profile);
results.setLimit(queryLimit);
int total = validateWorkItemQueryResult(results);
while (results.hasNext(null)) {
        //process the results
}

The results.setLimit(queryLimit); call is the part that is confusing.  It looks like we have already run the query in the line above, so then would setLimit() do anything at that point?  But if not, then how would I set the limit for the query before running the query itself?

Thanks,
Susan

1

1 vote

Comments

Looking at the code, effectively there has been a Count done when the getResolvedQyeryResults() call is executed, but no results are actually fetched yet.

the setLimit() sets the fetch size. and the fetch is done on the first next().



One answer

Permanent link
Perfect!  Thanks Sam

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Dec 26 '13, 11:20 p.m.

Question was seen: 4,122 times

Last updated: Jan 07 '14, 6:26 a.m.

Confirmation Cancel Confirm