Class CreateIndexCommand


  • public class CreateIndexCommand
    extends Command
    This command-class represents the CREATE INDEX DDL command.
    • Nested Class Summary

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ArrayList<java.lang.String> columnNames
      The list of column-names that the index is built against.
      private boolean ifNotExists
      If this flag is true then the create-index operation should only be performed if the specified index doesn't already exist.
      private java.lang.String indexName
      The name of the index being created.
      private static org.apache.logging.log4j.Logger logger
      A logging object for reporting anything interesting that happens.
      private CommandProperties properties
      Any additional properties specified in the command.
      private java.lang.String tableName
      The name of the table that the index is built against.
      private boolean unique
      This flag specifies whether the index is a unique index or not.
      • Fields inherited from class edu.caltech.nanodb.commands.Command

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      CreateIndexCommand​(java.lang.String indexName, java.lang.String tableName, boolean unique)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addColumn​(java.lang.String columnName)
      Adds a column to the list of columns to be included in the index.
      void execute​(NanoDBServer server)
      Actually performs the command.
      java.util.List<java.lang.String> getColumnNames()
      Returns the list of column names specified for the index as an unmodifiable list.
      boolean getIfNotExists()
      Returns true if index creation should only be attempted if it doesn't already exist, false if index creation should always be attempted.
      java.lang.String getIndexName()
      Get the name of the index to be dropped.
      CommandProperties getProperties()
      Returns any additional properties specified for the command, or null if no additional properties were specified.
      java.lang.String getTableName()
      Get the name of the table containing the index to be dropped.
      boolean isUnique()
      Returns true if the requested index is a unique index; false otherwise.
      void setIfNotExists​(boolean b)
      Sets the flag indicating whether index creation should only be attempted if it doesn't already exist.
      void setProperties​(CommandProperties properties)
      Sets any additional properties associated with the command.
      • Methods inherited from class java.lang.Object

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

      • logger

        private static org.apache.logging.log4j.Logger logger
        A logging object for reporting anything interesting that happens.
      • indexName

        private java.lang.String indexName
        The name of the index being created.
      • unique

        private boolean unique
        This flag specifies whether the index is a unique index or not. If the value is true then no key-value may appear multiple times; if the value is false then a key-value may appear multiple times.
      • ifNotExists

        private boolean ifNotExists
        If this flag is true then the create-index operation should only be performed if the specified index doesn't already exist.
      • tableName

        private java.lang.String tableName
        The name of the table that the index is built against.
      • columnNames

        private java.util.ArrayList<java.lang.String> columnNames
        The list of column-names that the index is built against. The order of these values is important; for ordered indexes, the index records must be kept in the order specified by the sequence of column names.
      • properties

        private CommandProperties properties
        Any additional properties specified in the command.
    • Constructor Detail

      • CreateIndexCommand

        public CreateIndexCommand​(java.lang.String indexName,
                                  java.lang.String tableName,
                                  boolean unique)
    • Method Detail

      • getIfNotExists

        public boolean getIfNotExists()
        Returns true if index creation should only be attempted if it doesn't already exist, false if index creation should always be attempted.
        Returns:
        true if index creation should only be attempted if it doesn't already exist, false if index creation should always be attempted.
      • setIfNotExists

        public void setIfNotExists​(boolean b)
        Sets the flag indicating whether index creation should only be attempted if it doesn't already exist.
        Parameters:
        b - the flag indicating whether index creation should only be attempted if it doesn't already exist.
      • getTableName

        public java.lang.String getTableName()
        Get the name of the table containing the index to be dropped.
        Returns:
        the name of the table containing the index to drop
      • getIndexName

        public java.lang.String getIndexName()
        Get the name of the index to be dropped.
        Returns:
        the name of the index to drop
      • getColumnNames

        public java.util.List<java.lang.String> getColumnNames()
        Returns the list of column names specified for the index as an unmodifiable list.
        Returns:
        the list of column names specified for the index as an unmodifiable list.
      • isUnique

        public boolean isUnique()
        Returns true if the requested index is a unique index; false otherwise.
        Returns:
        true if the requested index is a unique index; false otherwise.
      • setProperties

        public void setProperties​(CommandProperties properties)
        Sets any additional properties associated with the command. The value may be null to indicate no properties.
        Parameters:
        properties - any additional properties to associate with the command.
      • getProperties

        public CommandProperties getProperties()
        Returns any additional properties specified for the command, or null if no additional properties were specified.
        Returns:
        any additional properties specified for the command, or null if no additional properties were specified.
      • addColumn

        public void addColumn​(java.lang.String columnName)
        Adds a column to the list of columns to be included in the index.
        Parameters:
        columnName - the name of the column to add to the columns to be included in the index.