Class 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

    • 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  
      • Fields inherited from class edu.caltech.nanodb.commands.Command

        out
    • 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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • tableNames

        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.
      • verbose

        private boolean verbose
    • 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 the addTable(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 the addTable(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.
      • 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 class java.lang.Object
        Returns:
        a string representing this analyze command