Package oracle.nosql.driver.ops
Class QueryIterableResult
java.lang.Object
oracle.nosql.driver.ops.Result
oracle.nosql.driver.ops.QueryIterableResult
- All Implemented Interfaces:
AutoCloseable
,Iterable<MapValue>
QueryIterableResult represents an
Iterable
over all the query
results.
The shape of the values is based on the schema implied by the query. For example a query such as "SELECT * FROM ..." that returns an intact row will return values that conform to the schema of the table. Projections return instances that conform to the schema implied by the statement. UPDATE queries either return values based on a RETURNING clause or, by default, the number of rows affected by the statement.
Example:
NoSQLHandle handle = ...; try (QueryRequest qreq = new QueryRequest() .setStatement("select * from foo") ) { for (MapValue row : handle.queryIterable(qreq)) { // do something with row } }Note: The read/write KB/Units, rate limit delay and retry stats are summed up from the beginning of the iteration.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
Returns the read throughput consumed by all iterators of this operation, in KBytes.int
Returns the read throughput consumed by all iterators of this operation, in read units.int
Returns the write throughput consumed by all iterators of this operation, in KBytes.int
Returns the write throughput consumed by all iterators of this operation, in write units.iterator()
Returns an iterator over all results of a query.Methods inherited from class oracle.nosql.driver.ops.Result
getRateLimitDelayedMs, getRetryStats
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
iterator
Returns an iterator over all results of a query. Each call is treated as a separate query. The first server call is done at the time of the first hasNext()/next() call. Note: Objects returned by this method can only be used safely by one thread at a time unless synchronized externally. -
getReadKB
public int getReadKB()Returns the read throughput consumed by all iterators of this operation, in KBytes. This is the actual amount of data read by this operation. The number of read units consumed is returned bygetReadUnits()
which may be a larger number if the operation usedConsistency.ABSOLUTE
- Returns:
- the read KBytes consumed
-
getWriteKB
public int getWriteKB()Returns the write throughput consumed by all iterators of this operation, in KBytes.- Returns:
- the write KBytes consumed
-
getReadUnits
public int getReadUnits()Returns the read throughput consumed by all iterators of this operation, in read units. This number may be larger than that returned bygetReadKB()
if the operation usedConsistency.ABSOLUTE
- Returns:
- the read units consumed
-
getWriteUnits
public int getWriteUnits()Returns the write throughput consumed by all iterators of this operation, in write units.- Returns:
- the write units consumed
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-