Hi,
I am trying to execute a query in java and trying to fetch the result set using Iter Object. But Iterating through the result set return "null", but when i am executing the same query and getting Result object i am able to see the result set. Why this is happen. Please Help Me.
QueryProcessor pr = new QueryProcessor("let $a := /data/product/* return $a ",context); pr.context(dataset);
Now I am taking Iter object as:
Iter itr=pr.iter();
Now, executing itr.get(0) gives me "null", but when i execute it as
Result rs = pr.execute() Sytem.out.println("Products ::" + rs) ... it shows the fetch products.
But, also itr.next().serialise() also gives me the result.
PS: For more information, please read JavaDoc [1]. It tells: "Returns the specified item, or an arbitrary item if the index is invalid. This method needs to be implemented - and should only be called - if {@link Iter#size()} returns the correct number of results."
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/ba...
On Fri, Feb 6, 2015 at 1:53 PM, Christian Grün christian.gruen@gmail.com wrote:
Iter itr=pr.iter(); Now, executing itr.get(0) gives me "null"
pr.iter().next(); should work.
Thanks for your prompt reply. It is very helpful.
On 6 February 2015 at 18:25, Christian Grün christian.gruen@gmail.com wrote:
PS: For more information, please read JavaDoc [1]. It tells: "Returns the specified item, or an arbitrary item if the index is invalid. This method needs to be implemented - and should only be called - if {@link Iter#size()} returns the correct number of results."
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/ba...
On Fri, Feb 6, 2015 at 1:53 PM, Christian Grün christian.gruen@gmail.com wrote:
Iter itr=pr.iter(); Now, executing itr.get(0) gives me "null"
pr.iter().next(); should work.
basex-talk@mailman.uni-konstanz.de