Package edu.caltech.nanodb.server
Class CommandResult
- java.lang.Object
-
- edu.caltech.nanodb.server.CommandResult
-
- All Implemented Interfaces:
java.io.Serializable
public class CommandResult extends java.lang.Object implements java.io.Serializable
This class represents the result of executing a command against the database. Objects of this type may be serialized and sent across a communication channel. The command being executed is not included in this class because some commands have very complex and non-serializable representations, such asSelectCommand
s.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
CommandResult.ResultCollector
This inner class is used to collect the results of aSelectCommand
.
-
Field Summary
Fields Modifier and Type Field Description private long
endTimestamp
The system time when command execution ended.private boolean
exitCommand
A flag recording whether the command was an exit command or not.private java.lang.Exception
failure
If a failure occurs while a command is being executed, this will be the exception that indicated the failure.private long
firstResultTimestamp
The time to the first result being produced.private Schema
schema
If the command was a SELECT query and the results are to be kept, this will be the schema of the results as computed by the database.private long
startTimestamp
The system time when command execution started.private java.util.ArrayList<TupleLiteral>
tuples
If the command was a SELECT query and the results are to be kept, this will be a collection of the tuples in the order they were produced by the database.
-
Constructor Summary
Constructors Constructor Description CommandResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
collectSelectResults(SelectCommand command)
void
endExecution()
boolean
failed()
java.lang.Exception
getFailure()
Schema
getSchema()
long
getTimeToFirstResult()
Returns the time to the first result in milliseconds.long
getTotalTime()
Returns the total execution time of the command in milliseconds.java.util.List<TupleLiteral>
getTuples()
boolean
isExit()
void
recordFailure(java.lang.Exception e)
void
setExit()
void
startExecution()
-
-
-
Field Detail
-
startTimestamp
private long startTimestamp
The system time when command execution started.
-
endTimestamp
private long endTimestamp
The system time when command execution ended.
-
exitCommand
private boolean exitCommand
A flag recording whether the command was an exit command or not.
-
failure
private java.lang.Exception failure
If a failure occurs while a command is being executed, this will be the exception that indicated the failure.
-
firstResultTimestamp
private long firstResultTimestamp
The time to the first result being produced.
-
schema
private Schema schema
If the command was a SELECT query and the results are to be kept, this will be the schema of the results as computed by the database.
-
tuples
private java.util.ArrayList<TupleLiteral> tuples
If the command was a SELECT query and the results are to be kept, this will be a collection of the tuples in the order they were produced by the database.
-
-
Method Detail
-
startExecution
public void startExecution()
-
collectSelectResults
public void collectSelectResults(SelectCommand command)
-
recordFailure
public void recordFailure(java.lang.Exception e)
-
setExit
public void setExit()
-
isExit
public boolean isExit()
-
failed
public boolean failed()
-
getFailure
public java.lang.Exception getFailure()
-
endExecution
public void endExecution()
-
getTotalTime
public long getTotalTime()
Returns the total execution time of the command in milliseconds.- Returns:
- the total execution time of the command in milliseconds.
-
getTimeToFirstResult
public long getTimeToFirstResult()
Returns the time to the first result in milliseconds.- Returns:
- the time to the first result in milliseconds.
-
getSchema
public Schema getSchema()
-
getTuples
public java.util.List<TupleLiteral> getTuples()
-
-