Class QueryResult

java.lang.Object
oracle.nosql.driver.ops.Result
oracle.nosql.driver.ops.QueryResult

public class QueryResult extends Result
QueryResult comprises a list of MapValue instances representing 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.

A single QueryResult does not imply that all results for the query have been returned. If the value returned by getContinuationKey() is not null there are additional results available. This can happen even if there are no values in the returned QueryResult. The best way to use QueryRequest and QueryResult is to perform operations in a loop, for example:

 NoSQLHandle handle = ...;

 try (QueryRequest qreq = new QueryRequest()
   .setStatement("select * from * foo")) {

   do {
     QueryResult qres = handle.query(qreq);
     List<MapValue> results = qres.getResults();
     // do something with the results
   } while (!qreq.isDone());
 }
 
See Also:
  • Method Details

    • getResults

      public List<MapValue> getResults()
      Returns a list of results for the query. It is possible to have an empty list and a non-null continuation key.
      Returns:
      the query results
    • getContinuationKey

      public byte[] getContinuationKey()
      Returns the continuation key that can be used to obtain more results if non-null.
      Returns:
      the continuation key, or null if there are no further values to return.
    • getReadKB

      public int getReadKB()
      Returns the read throughput consumed by this operation, in KBytes. This is the actual amount of data read by the operation. The number of read units consumed is returned by getReadUnits() which may be a larger number if the operation used Consistency.ABSOLUTE
      Returns:
      the read KBytes consumed
    • getWriteKB

      public int getWriteKB()
      Returns the write throughput consumed by this operation, in KBytes.
      Returns:
      the write KBytes consumed
    • getReadUnits

      public int getReadUnits()
      Returns the read throughput consumed by this operation, in read units. This number may be larger than that returned by getReadKB() if the operation used Consistency.ABSOLUTE
      Returns:
      the read units consumed
    • getWriteUnits

      public int getWriteUnits()
      Returns the write throughput consumed by this operation, in write units.
      Returns:
      the write units consumed
    • toString

      public String toString()
      Overrides:
      toString in class Object