Class OptimizeCommand


  • public class OptimizeCommand
    extends Command
    This Command class represents the OPTIMIZE SQL command, which optimizes a table's representation (along with any indexes) to improve access performance and space utilization. This is not a standard SQL command.
    • 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.
      • Fields inherited from class edu.caltech.nanodb.commands.Command

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      OptimizeCommand()
      Construct a new OPTIMIZE command with an empty table list.
      OptimizeCommand​(java.lang.String tableName)
      Construct a new OPTIMIZE command to optimize 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 optimize.
      void execute​(NanoDBServer server)
      Actually performs the command.
      java.util.Set<java.lang.String> getTableNames()
      Returns the set of tables to optimize in an unmodifiable set.
      java.lang.String toString()
      Prints a simple representation of the optimize command, including the names of the tables to be optimized.
      • 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.
    • Constructor Detail

      • OptimizeCommand

        public OptimizeCommand()
        Construct a new OPTIMIZE command with an empty table list. Tables can be added to the internal list using the addTable(java.lang.String) method.
      • OptimizeCommand

        public OptimizeCommand​(java.lang.String tableName)
        Construct a new OPTIMIZE command to optimize the specified table.
        Parameters:
        tableName - the name of the table to optimize.
    • Method Detail

      • addTable

        public void addTable​(java.lang.String tableName)
        Add a table to the list of tables to optimize.
        Parameters:
        tableName - the name of the table to optimize.
      • getTableNames

        public java.util.Set<java.lang.String> getTableNames()
        Returns the set of tables to optimize in an unmodifiable set.
        Returns:
        the set of tables to optimize in an unmodifiable set.
      • toString

        public java.lang.String toString()
        Prints a simple representation of the optimize command, including the names of the tables to be optimized.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representing this optimize command