Interface Statement

All Known Implementing Classes:
AbstractQueryPlusStatementBuilder.AbstractStatement, AbstractSnapshotStatement, AbstractStatement, ArchiveSnapshotStatementBuilder.ArchiveSnapshotStatement, BackupStatementBuilder.BackupStatement, CommandsStatementBuilder.CommandsQueryPlusStatement, CreateCacheStatementBuilder.CreateCacheStatement, CreateIndexStatementBuilder.CreateIndexStatement, CreateSnapshotStatementBuilder.CreateSnapshotStatement, DeleteStatementBuilder.DeleteStatement, DropCacheStatementBuilder.DropCacheStatement, DropIndexStatementBuilder.DropIndexStatement, ExtendedLanguageStatementBuilder.ExtendedLanguageQueryPlusStatement, ForceRecoveryStatementBuilder.ForceRecoveryStatement, HelpStatementBuilder.HelpQueryPlusStatement, InsertStatementBuilder.InsertStatement, ListArchiverStatementBuilder.ListArchiverStatement, ListServicesStatementBuilder.ListServicesStatement, ListSnapshotsStatementBuilder.ListSnapshotsStatement, QueryRecorderStatementBuilder.QueryRecorderStatement, RecoverSnapshotStatementBuilder.RecoverSnapshotStatement, RemoveSnapshotStatementBuilder.RemoveSnapshotStatement, RestoreStatementBuilder.RestoreStatement, ResumeServiceStatementBuilder.ResumeServiceStatement, RetrieveSnapshotStatementBuilder.RetrieveSnapshotStatement, SanityCheckStatementBuilder.SanityCheckQueryPlusStatement, SelectStatementBuilder.SelectStatement, ServicesStatementBuilder.ServicesQueryPlusStatement, SetTimeoutStatementBuilder.SetTimeoutStatement, SourceStatementBuilder.SourceStatement, SuspendServiceStatementBuilder.SuspendServiceStatement, TraceStatementBuilder.TraceQueryPlusStatement, TruncateCacheStatementBuilder.TruncateCacheStatement, UpdateStatementBuilder.UpdateStatement, ValidateSnapshotStatementBuilder.ValidateSnapshotStatement, WheneverStatementBuilder.WheneverQueryPlusStatement

public interface Statement
Implementations of this interface are able to execute CohQL statements, for example a Select, Update, a backup command etc.

Each execution is provided a context in which to execute the statement and is obliged to return a result to the caller. Ths allows the caller to invoke statement agnostic operations, which each implementation can specialize based on the format of the results.

Since:
Coherence 12.2.1
Author:
jk 2013.12.09
See Also:
  • Method Details

    • execute

      Execute a CohQL query or command and return the relevant result.
      Parameters:
      ctx - the context to use
      Returns:
      a StatementResult containing the results of executing the statement
    • executeAsync

      default CompletableFuture<StatementResult> executeAsync(ExecutionContext ctx)
      Execute a CohQL query or command asynchronously and return the CompletableFuture with the relevant result.
      Parameters:
      ctx - the context to use
      Returns:
      a StatementResult future containing the results of executing the statement
      Throws:
      UnsupportedOperationException - if this statement does not support asynchronous execution
    • sanityCheck

      void sanityCheck(ExecutionContext ctx)
      Perform sanity checks on the statement that will be executed.

      Implementations can fail sanity checking by throwing an unchecked exception (RuntimeException).

      Parameters:
      ctx - the context to use
      Throws:
      RuntimeException - if sanity checking fails
    • showPlan

      void showPlan(PrintWriter out)
      Output to the provided PrintWriter a human readable trace of the actions that will be taken by this statement if or when executed.
      Parameters:
      out - the PrintWriter to write the trace to
    • getExecutionConfirmation

      String getExecutionConfirmation(ExecutionContext ctx)
      Return a string that will be used as a question to confirm execution of a statement. If null is returned then no confirmation is required.
      Parameters:
      ctx - the context to use
      Returns:
      a String that will be used to confirm execution of a statement
    • isManagingTimeout

      default boolean isManagingTimeout()
      Obtain a flag indicating whether this Statement will manage its own timeout handling.
      Returns:
      true if this Statement manages timeout handling or false if the StatementExecutor should manage timeouts.