on 05-10-2005 3:43 AM
Hi,
I am using MDME Java API. I want to know how the multiple records running into several pages is handled. I know that there is a method SetSize() in ResultSetDefinition class and I also know that the method GetResultSet() uses the page(probably page number) as an argument. But, I am not sure how to use this feature for practical purposes.
Can anybody help me??
Thanks in Advance,
Rajani
Hi Rajani,
The paging feature comes in handy if you have a very large dataset you need to iterate through. Using the page number and SetSize() method allows you to efficiently loop through the resultset. Here's some sample code:
// loop through the resultset, retrieving a page a time until all records have been processed
while (isDone == false) {
A2iResultSet rs = catalog.GetResultSet(search, rsd, sortField, sortAscending, page);
// process the records
processProdRecords(rs);
// increment counter
page++;
// are there more records?
if ((page * pageSize) >= search.GetNumSearchTableResults())
isDone = true;
}
Regards,
Oliver
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajani,
Just one small comment to Oliver's reply. MDME connection classes though are quite similar to JDBC connection family by nature have one very important pecuriality. They're not stateful. So for example you don't have to close A2iResultSet as you would have done to in the JDBC analogy. Saying that, I mean that the mechanism behind the scene performs the search every time when you do fetching. Practically speaking it's not important at all since all operations are exectuted very fast (memory based in general). Just wanted to answer an anticipating question in advance about closing ResultSet object.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.