Package edu.caltech.nanodb.commands
Class AnalyzeCommand
- java.lang.Object
-
- edu.caltech.nanodb.commands.Command
-
- edu.caltech.nanodb.commands.AnalyzeCommand
-
public class AnalyzeCommand extends Command
This Command class represents the ANALYZE SQL command, which analyzes a table's internal data and updates its cached statistics to be as up-to-date as possible. This is not a standard SQL command, but virtually every good database has a mechanism to manually perform this task.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class edu.caltech.nanodb.commands.Command
Command.Type
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.LinkedHashSet<java.lang.String>
tableNames
Table names are kept in a set so that we don't need to worry about a particular table being specified multiple times.private boolean
verbose
-
Constructor Summary
Constructors Constructor Description AnalyzeCommand()
Construct a new ANALYZE command with an empty table list.AnalyzeCommand(boolean verbose)
Construct a new ANALYZE command with an empty table list.AnalyzeCommand(java.lang.String tableName)
Construct a new ANALYZE command to analyze the specified table.AnalyzeCommand(java.lang.String tableName, boolean verbose)
Construct a new ANALYZE command to analyze the specified table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTable(java.lang.String tableName)
Add a table to the list of tables to analyze.void
execute(NanoDBServer server)
Actually performs the command.java.util.Set<java.lang.String>
getTableNames()
Returns the set of tables to analyze in an unmodifiable set.java.lang.String
toString()
Prints a simple representation of the analyze command, including the names of the tables to be analyzed.-
Methods inherited from class edu.caltech.nanodb.commands.Command
getCommandType
-
-
-
-
Constructor Detail
-
AnalyzeCommand
public AnalyzeCommand(boolean verbose)
Construct a new ANALYZE command with an empty table list. Tables can be added to the internal list using theaddTable(java.lang.String)
method.- Parameters:
verbose
- a flag indicating whether this command should produce verbose output
-
AnalyzeCommand
public AnalyzeCommand()
Construct a new ANALYZE command with an empty table list. Tables can be added to the internal list using theaddTable(java.lang.String)
method.
-
AnalyzeCommand
public AnalyzeCommand(java.lang.String tableName)
Construct a new ANALYZE command to analyze the specified table.- Parameters:
tableName
- the name of the table to analyze.
-
AnalyzeCommand
public AnalyzeCommand(java.lang.String tableName, boolean verbose)
Construct a new ANALYZE command to analyze the specified table.- Parameters:
tableName
- the name of the table to analyze.verbose
- a flag indicating whether this command should produce verbose output
-
-
Method Detail
-
addTable
public void addTable(java.lang.String tableName)
Add a table to the list of tables to analyze.- Parameters:
tableName
- the name of the table to analyze.
-
getTableNames
public java.util.Set<java.lang.String> getTableNames()
Returns the set of tables to analyze in an unmodifiable set.- Returns:
- the set of tables to analyze in an unmodifiable set.
-
execute
public void execute(NanoDBServer server) throws ExecutionException
Description copied from class:Command
Actually performs the command.- Specified by:
execute
in classCommand
- Throws:
ExecutionException
- if an issue occurs during command execution
-
toString
public java.lang.String toString()
Prints a simple representation of the analyze command, including the names of the tables to be analyzed.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representing this analyze command
-
-