Interface Query<R>


public interface Query<R>
Represents a sharable object which performs a query against a table. Queries might require additional arguments to be supplied, as required by the query expression.
See Also:
  • Method Details

    • newScanner

      default Scanner<R> newScanner(Transaction txn, Object... args) throws IOException
      Returns a new scanner for all the rows of this query.
      Parameters:
      txn - optional transaction for the scanner to use; pass null for auto-commit mode
      args - arguments required by this query
      Returns:
      a new scanner positioned at the first row in the table accepted by the query
      Throws:
      IllegalStateException - if transaction belongs to another database instance
      IOException
    • newUpdater

      default Updater<R> newUpdater(Transaction txn, Object... args) throws IOException
      Returns a new updater for all the rows of this query.
      Parameters:
      txn - optional transaction for the updater to use; pass null for auto-commit mode
      args - arguments required by this query
      Returns:
      a new updater positioned at the first row in the table accepted by the query
      Throws:
      IllegalStateException - if transaction belongs to another database instance
      IOException
    • newStream

      default Stream<R> newStream(Transaction txn, Object... args)
      Returns a new stream for all the rows of this query.
      Parameters:
      txn - optional transaction for the stream to use; pass null for auto-commit mode
      args - arguments required by this query
      Returns:
      a new stream positioned at the first row in the table accepted by the query
      Throws:
      IllegalStateException - if transaction belongs to another database instance
    • deleteAll

      default long deleteAll(Transaction txn, Object... args) throws IOException
      Deletes all rows specified by this query.
      Parameters:
      txn - optional transaction to use; pass null for auto-commit mode against each row
      args - arguments required by this query
      Returns:
      the amount of rows deleted
      Throws:
      IllegalStateException - if transaction belongs to another database instance
      IOException
    • anyRows

      default boolean anyRows(Transaction txn, Object... args) throws IOException
      Returns true if this query produces any rows.
      Parameters:
      txn - optional transaction to use; pass null for auto-commit mode
      args - arguments required by this query
      Throws:
      IllegalStateException - if transaction belongs to another database instance
      IOException
      See Also:
    • scannerPlan

      QueryPlan scannerPlan(Transaction txn, Object... args) throws IOException
      Returns a query plan used by newScanner.
      Parameters:
      txn - optional transaction to be used; pass null for auto-commit mode
      args - optional query arguments
      Throws:
      IOException
    • updaterPlan

      default QueryPlan updaterPlan(Transaction txn, Object... args) throws IOException
      Returns a query plan used by newUpdater.
      Parameters:
      txn - optional transaction to be used; pass null for auto-commit mode
      args - optional query arguments
      Throws:
      IOException
    • streamPlan

      default QueryPlan streamPlan(Transaction txn, Object... args) throws IOException
      Returns a query plan used by newStream.
      Parameters:
      txn - optional transaction to be used; pass null for auto-commit mode
      args - optional query arguments
      Throws:
      IOException