Package com.kuzudb

Class QueryResult

java.lang.Object
com.kuzudb.QueryResult
All Implemented Interfaces:
AutoCloseable

public class QueryResult extends Object implements AutoCloseable
QueryResult stores the result of a query execution.
  • Constructor Details

    • QueryResult

      public QueryResult()
  • Method Details

    • close

      public void close()
      Close the query result and release the underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.
      Specified by:
      close in interface AutoCloseable
      Throws:
      RuntimeException - If the query result has been destroyed.
    • isOwnedByCPP

      public boolean isOwnedByCPP()
    • isSuccess

      public boolean isSuccess()
      Check if the query is executed successfully.
      Returns:
      Query is executed successfully or not.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getErrorMessage

      public String getErrorMessage()
      Get the error message if any.
      Returns:
      Error message of the query execution if the query fails.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getNumColumns

      public long getNumColumns()
      Get the number of columns in the query result.
      Returns:
      The number of columns in the query result.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getColumnName

      public String getColumnName(long index)
      Get the column name at the given index.
      Parameters:
      index - : The index of the column.
      Returns:
      The column name at the given index.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getColumnDataType

      public DataType getColumnDataType(long index)
      Get the column data type at the given index.
      Parameters:
      index - : The index of the column.
      Returns:
      The column data type at the given index.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getNumTuples

      public long getNumTuples()
      Get the number of tuples in the query result.
      Returns:
      The number of tuples in the query result.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getQuerySummary

      public QuerySummary getQuerySummary()
      Get the query summary.
      Returns:
      The query summary.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • hasNext

      public boolean hasNext()
      Return if the query result has next tuple or not.
      Returns:
      Whether there are more tuples to read.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getNext

      public FlatTuple getNext()
      Get the next tuple. Note that to reduce resource allocation, all calls to getNext() reuse the same FlatTuple object. Since its contents will be overwritten, please complete processing a FlatTuple or make a copy of its data before calling getNext() again.
      Returns:
      The next tuple.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • hasNextQueryResult

      public boolean hasNextQueryResult()
      Return if the query result has next query result or not.
      Returns:
      Whether there are more query results to read.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • getNextQueryResult

      public QueryResult getNextQueryResult()
      Get the next query result.
      Returns:
      The next query result.
      Throws:
      RuntimeException - If the query result has been destroyed.
    • toString

      public String toString()
      Convert the query result to string.
      Overrides:
      toString in class Object
      Returns:
      The string representation of the query result.
    • resetIterator

      public void resetIterator()
      Reset the query result iterator.
      Throws:
      RuntimeException - If the query result has been destroyed.