public interface Statement
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.
StatementResult
Modifier and Type | Method and Description |
---|---|
StatementResult |
execute(ExecutionContext ctx)
Execute a CohQL query or command and return the relevant
result . |
String |
getExecutionConfirmation(ExecutionContext ctx)
Return a string that will be used as a question to confirm execution of
a statement.
|
default boolean |
isManagingTimeout()
Obtain a flag indicating whether this Statement will manage its own
timeout handling.
|
void |
sanityCheck(ExecutionContext ctx)
Perform sanity checks on the statement that will be executed.
|
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. |
StatementResult execute(ExecutionContext ctx)
result
.ctx
- the context
to usevoid sanityCheck(ExecutionContext ctx)
Implementations can fail sanity checking by throwing an unchecked exception (RuntimeException).
ctx
- the context
to useRuntimeException
- if sanity checking failsvoid showPlan(PrintWriter out)
PrintWriter
a human readable trace of the
actions that will be taken by this statement if or when executed.out
- the PrintWriter to write the trace toString getExecutionConfirmation(ExecutionContext ctx)
ctx
- the context
to usedefault boolean isManagingTimeout()