Package edu.caltech.nanodb.commands
Class SelectCommand
- java.lang.Object
-
- edu.caltech.nanodb.commands.Command
-
- edu.caltech.nanodb.commands.QueryCommand
-
- edu.caltech.nanodb.commands.SelectCommand
-
public class SelectCommand extends QueryCommand
This command object represents a top-level SELECT command issued against the database. The query itself is represented by theSelectClause
class, particularly because a SELECT statement can itself contain other SELECT statements.- See Also:
SelectClause
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.caltech.nanodb.commands.QueryCommand
QueryCommand.Type
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
logger
A logging object for reporting anything interesting that happens.private SelectClause
selClause
This object contains all the details of the top-level select clause, including any subqueries, that is going to be evaluated.private TupleProcessor
tupleProcessor
-
Fields inherited from class edu.caltech.nanodb.commands.QueryCommand
explain, plan
-
-
Constructor Summary
Constructors Constructor Description SelectCommand(SelectClause selClause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SelectClause
getSelectClause()
Returns the root select-clause for this select command.protected TupleProcessor
getTupleProcessor(EventDispatcher eventDispatcher)
Creates a tuple-processor responsible for dealing with the tuples that are generated by the query command.protected void
prepareQueryPlan(NanoDBServer server)
Prepares the SELECT statement for evaluation by analyzing the schema details of the statement, and then preparing an execution plan for the statement.void
setTupleProcessor(TupleProcessor tupleProcessor)
java.lang.String
toString()
-
Methods inherited from class edu.caltech.nanodb.commands.QueryCommand
execute, setExplain
-
Methods inherited from class edu.caltech.nanodb.commands.Command
getCommandType
-
-
-
-
Field Detail
-
logger
private static org.apache.logging.log4j.Logger logger
A logging object for reporting anything interesting that happens.
-
selClause
private SelectClause selClause
This object contains all the details of the top-level select clause, including any subqueries, that is going to be evaluated.
-
tupleProcessor
private TupleProcessor tupleProcessor
-
-
Constructor Detail
-
SelectCommand
public SelectCommand(SelectClause selClause)
-
-
Method Detail
-
getSelectClause
public SelectClause getSelectClause()
Returns the root select-clause for this select command.- Returns:
- the root select-clause for this select command
-
prepareQueryPlan
protected void prepareQueryPlan(NanoDBServer server)
Prepares the SELECT statement for evaluation by analyzing the schema details of the statement, and then preparing an execution plan for the statement.- Specified by:
prepareQueryPlan
in classQueryCommand
- Parameters:
server
- the server to use for planning, fetching table schemas, statistics, and other details relevant for planning
-
setTupleProcessor
public void setTupleProcessor(TupleProcessor tupleProcessor)
-
getTupleProcessor
protected TupleProcessor getTupleProcessor(EventDispatcher eventDispatcher)
Description copied from class:QueryCommand
Creates a tuple-processor responsible for dealing with the tuples that are generated by the query command. Depending on the operation being performed, different tuple-processors are appropriate. For example, the SELECT processor sends the tuples to the console or to a remote client; the DELETE processor deletes the tuples from the referenced table.- Specified by:
getTupleProcessor
in classQueryCommand
- Parameters:
eventDispatcher
- used for notifying other components in the database when rows are inserted/updated/deleted- Returns:
- the tuple processor to use in processing tuples generated by the query
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-