|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
This interface represents a sequence of items obtained as a result of
evaluation XQuery expressions. The result sequence is tied to the
XQconnection object on which the expression was evaluated.
This sequence can be obtained by performing an executeQuery
on the expression object. It represents a cursor-like interface.
The XQResultSequence object is dependent on
the connection and the expression from which it was created and is only
valid for the duration of those objects. Thus, if any one of those objects is closed,
this XQResultSequence object will be implicitly closed
and it can no longer be used. Similarly re-executing the expression
also implicitly closes the associated result sequences.
An XQJ driver is not required to provide finalizer methods for the connection and other objects. Hence it is strongly recommended that users call close method explicitly to free any resources. It is also recommended that they do so under a final block to ensure that the object is closed even when there are exceptions. Not closing this object implicitly or explicitly might result in serious memory leaks.
When the XQResultSequence is closed any
XQResultItem objects obtained from it
are also implicitly closed.
Example -
XQPreparedExpression expr = conn.prepareExpression("for $i ..");
XQResultSequence result = expr.executeQuery();
// create the ItemTypes for string and integer
XQItemType strType = conn.createAtomicType(XQItemType.XQBASETYPE_STRING);
XQItemType intType = conn.createAtomicType(XQItemType.XQBASETYPE_INT);
// posititioned before the first item
while (result.next())
{
XQItemType type = result.getItemType();
// If string or any of its subtypes, then get the string value out
if (type.isOfType(strType))
String str = result.getAtomicValue();
else if (type.isOfType(intType)) // if it is an integer..
int intval = result.getInt();
...
}
result.close(); // explicitly close the result sequence
| Method Summary | |
void |
clearWarnings()
Clears the list of warnings associated with this result sequence |
XQConnection |
getConnection()
Gets the XQuery connection associated with this result sequence |
XQWarning |
getWarnings()
Gets the first warning in the list of warnings associated with this result sequence. |
| Methods inherited from interface com.ddtek.xquery3.XQSequence |
absolute, afterLast, beforeFirst, close, count, first, getItem, getPosition, getSequenceAsStream, getSequenceAsString, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isOnItem, isScrollable, last, next, previous, relative, writeSequence, writeSequence, writeSequenceToResult, writeSequenceToSAX |
| Methods inherited from interface com.ddtek.xquery3.XQItemAccessor |
getAtomicValue, getBoolean, getByte, getDouble, getFloat, getInt, getItemAsStream, getItemAsString, getItemType, getLong, getNode, getNodeUri, getObject, getObject, getShort, instanceOf, writeItem, writeItem, writeItemToResult, writeItemToSAX |
| Method Detail |
public void clearWarnings()
throws XQException
XQException - if the sequence is in a closed state.
public XQConnection getConnection()
throws XQException
XQException - if the result sequence is in a closed state
public XQWarning getWarnings()
throws XQException
null if there are no warnings
XQException - if the result sequence is in a closed state
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||