Hello,
can you please give me an example of how to use the cursoring function when i use the response as stream??
Iam a little confused, because iam trying to get the response as TInputStream with the TStreamAccessor. That works fine…but now i have the problem of big results and i want to cursor trough the result. Get the first 100 than the next 100 results…and so on. Then i write the first to a file, till i received the complete result.
Can you please help me. I already found somebody asking for this problem…and the answer was use the fetchCursor()-Method, but sorry…cant you give us a example code or sth like this??
Thank you very much!
My code looks like this:
TXQuery xqueryBuffer = TXQuery.newInstance(sbQuery.toString());
// Invoke the query operation
TInputStream response = streamAccessor.xquery(xqueryBuffer);
//TInputStream response = streamAccessor.openCursor(xqueryBuffer, 1, 4000);
long lDuration = System.currentTimeMillis() - lStartDuration;
logger.info("XQuery duration: " + lDuration + " ms");
try {
//TInputStream test = streamAccessor.fetchCursor("response", 1, 100);
BufferedReader in = new BufferedReader(new InputStreamReader(
response,"UTF8"));
String str = "";
while (in.ready()) {
str = in.readLine();
stringWriter.append(str);
}
} catch (IOException e) {
}