Package com.orchestranetworks.query
Interface QueryResult<T>
- All Superinterfaces:
AutoCloseable,Iterable<T>
Represents the result of a query.
Traversing and closing the result
A QueryResult instance must always be closed after its use.
Here is a code sample benefiting from the automatic closing provided by
AutoCloseable and its associated try-with-resources notation:
Query<Tuple> query = dataset.createQuery("SELECT id, name FROM customer");
try (QueryResult<Tuple> result = query.getResult())
{
for (Tuple t : result)
{
Integer id = t.get(0, Integer.class);
String name = t.get(1, String.class);
...
}
}
Note that a QueryResult supports just one active iterator at a time. When creating
an iterator, any iterator previously created for this QueryResult will be invalidated.
Concurrency
A QueryResult instance is not thread-safe and
it must be used only by the thread that created it.
If the table is concurrently updated, the rules specified by Query snapshot isolation apply.
- Since:
- 6.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the names of the fields in the resultReturns the types of the fields in the resultMethods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getFieldNames
Returns the names of the fields in the result -
getFieldTypes
Returns the types of the fields in the result -
close
void close()- Specified by:
closein interfaceAutoCloseable
-