A query result set contains the results of a query.
The elements of the result set are objects that the caller is authorized to see. You can read elements in a relative fashion using the next method or in an absolute fashion using the first and last methods. Because the implicit cursor of a query result set is initially positioned before the first element, you must call either the first or next methods before reading an element. You can use the size method to determine the number of elements in the set.
An element of the query result set comprises the selected attributes of work items and their associated referenced objects, such as activity instances and process instances. The first attribute (column) of a QueryResultSet element specifies the value of the first attribute specified in the select clause of the query request. The second attribute (column) of a QueryResultSet element specifies the value of the second attribute specified in the select clause of the query request, and so on.
You can retrieve the values of the attributes by calling a method that is compatible with the attribute type and by specifying the appropriate column index. The numbering of the column indexes starts with 1.
Attribute type | Method |
---|---|
String | getString |
ID | getOID |
Timestamp | getTimestamp |
Integer | getInteger |
Boolean | getBoolean |
CHAR FOR BIT DATA | getBinary |
Example:
QueryResultSet resultSet = process.query("ACTIVITY.STARTED, ACTIVITY.TEMPLATE_NAME AS NAME, WORK_ITEM.WIID, WORK_ITEM.REASON", null, null, null, null);
The returned query result set has four columns:
while (resultSet.next()) { java.util.Calendar activityStarted = resultSet.getTimestamp(1); String templateName = resultSet.getString(2); WIID wiid = (WIID) resultSet.getOID(3); Integer reason = resultSet.getInteger(4); }
resultSet.getColumnDisplayName(1) returns "STARTED" resultSet.getColumnDisplayName(2) returns "NAME" resultSet.getColumnDisplayName(3) returns "WIID" resultSet.getColumnDisplayName(4) returns "REASON"
Last updated: Thu Apr 27 14:54:56 2006
(c) Copyright IBM Corporation 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)