|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface QueryResponse
Represents a result of query execution. It potentially contain a mix of update counts and lists of selected values. Provides API somewhat similar to java.util.Iterator or java.sql.ResultSet for scanning through the individual results.
An example of iterating through a response:
QueryResponse response = context.performGenericQuery(query); for (response.reset(); response.next();) { if (response.isList()) { List list = response.currentList(); // ... } else { int[] updateCounts = reponse.currentUpdateCount(); // ... } }
In case the structure of the result is known, and only a single list or an update count is expected, there is a simpler API to access them:
QueryResponse response = context.performGenericQuery(query); List list = response.firstList(); int[] count = response.firstUpdateCount();
Method Summary | |
---|---|
java.util.List |
currentList()
Returns a List under the current iterator position. |
int[] |
currentUpdateCount()
Returns an update count under the current iterator position. |
java.util.List |
firstList()
A utility method for quickly retrieving the first list in the response. |
int[] |
firstUpdateCount()
A utility method for quickly retrieving the first update count from the response. |
boolean |
isList()
Returns whether current iteration result is a list or an update count. |
boolean |
next()
Rewinds response iterator to the next result, returning true if it is available. |
void |
reset()
Restarts response iterator. |
int |
size()
Returns a number of results in the response. |
Method Detail |
---|
int size()
boolean isList()
java.util.List currentList()
isList()
to check
the result type before calling this method.
int[] currentUpdateCount()
isList()
to check the result type before calling this
method.
boolean next()
void reset()
java.util.List firstList()
int[] firstUpdateCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |