Class DefaultN1qlQueryResult

java.lang.Object
com.couchbase.client.java.query.DefaultN1qlQueryResult
All Implemented Interfaces:
N1qlQueryResult, Iterable<N1qlQueryRow>

@Committed
@Public
public class DefaultN1qlQueryResult
extends Object
implements N1qlQueryResult
  • Constructor Details

    • DefaultN1qlQueryResult

      public DefaultN1qlQueryResult​(List<AsyncN1qlQueryRow> rows, Object signature, N1qlMetrics info, List<JsonObject> errors, JsonObject profileInfo, String finalStatus, Boolean finalSuccess, boolean parseSuccess, String requestId, String clientContextId)
      Create a default blocking representation of a query result.
      Parameters:
      rows - the list of rows.
      signature - the signature for rows.
      info - the metrics.
      profileInfo - the profile information
      errors - the list of errors and warnings.
      finalStatus - the definitive (but potentially delayed) status of the query.
      finalSuccess - the definitive (but potentially delayed) success of the query.
      parseSuccess - the intermediate result of the query
  • Method Details

    • allRows

      public List<N1qlQueryRow> allRows()
      Specified by:
      allRows in interface N1qlQueryResult
      Returns:
      the list of all N1qlQueryRow, the results of the query, if successful.
    • rows

      public Iterator<N1qlQueryRow> rows()
      Specified by:
      rows in interface N1qlQueryResult
      Returns:
      an iterator over the list of all N1qlQueryRow, the results of the query, if successful.
    • signature

      public Object signature()
      Specified by:
      signature in interface N1qlQueryResult
      Returns:
      an object representing the signature of the results, that can be used to learn about the common structure of each row. This signature is usually a JsonObject, but could also be any JSON-valid type like a boolean scalar, JsonArray...
    • info

      public N1qlMetrics info()
      Specified by:
      info in interface N1qlQueryResult
      Returns:
      an object describing some metrics/info about the execution of the query.
    • profileInfo

      public JsonObject profileInfo()
      Specified by:
      profileInfo in interface N1qlQueryResult
      Returns:
      an object describing some profiling info about the execution of the query.
    • parseSuccess

      public boolean parseSuccess()
      Specified by:
      parseSuccess in interface N1qlQueryResult
      Returns:
      true if the query could be parsed, false if it short-circuited due to syntax/fatal error.
    • errors

      public List<JsonObject> errors()
      Specified by:
      errors in interface N1qlQueryResult
      Returns:
      A list of errors or warnings encountered while executing the query.
    • finalSuccess

      public boolean finalSuccess()
      Description copied from interface: N1qlQueryResult
      Denotes the success or failure of the query. It could fail slower than with N1qlQueryResult.parseSuccess(), for example if a fatal error comes up while streaming the results to the client. This method blocks until the query is over and the success can be established.
      Specified by:
      finalSuccess in interface N1qlQueryResult
    • status

      public String status()
      Description copied from interface: N1qlQueryResult
      Returns the final status of the query. For example, a successful query will return "success" (which is equivalent to N1qlQueryResult.finalSuccess() returning true). Other statuses include (but are not limited to) "fatal" when fatal errors occurred and "timeout" when the query timed out on the server side but not yet on the client side. This method blocks until the query is over and the status can be established.
      Specified by:
      status in interface N1qlQueryResult
    • iterator

      public Iterator<N1qlQueryRow> iterator()
      Specified by:
      iterator in interface Iterable<N1qlQueryRow>
    • requestId

      public String requestId()
      Specified by:
      requestId in interface N1qlQueryResult
      Returns:
      the requestId generated by the server
    • clientContextId

      public String clientContextId()
      Specified by:
      clientContextId in interface N1qlQueryResult
      Returns:
      the clientContextId that was set by the client (could be truncated to 64 bytes of UTF-8 chars)
    • toString

      public String toString()
      Overrides:
      toString in class Object