All Implemented Interfaces:
IIndex, IOptionContainer, ISearchPath, ISimpleColumnContainer, ISimpleOptionContainer, IStatement, ISubElement, IHashable

public class MsIndex extends MsAbstractStatement implements IIndex
Represents a Microsoft SQL index with support for clustered, non-clustered, and columnstore indexes.
  • Constructor Details

    • MsIndex

      public MsIndex(String name)
      Creates a new Microsoft SQL index.
      Parameters:
      name - the index name
  • Method Details

    • getCreationSQL

      public void getCreationSQL(SQLScript script)
      Description copied from interface: IStatement
      Generates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.
      Specified by:
      getCreationSQL in interface IStatement
      Parameters:
      script - the SQL script to append creation statements to
    • appendAlterSQL

      public ObjectState appendAlterSQL(IStatement newCondition, SQLScript script)
      Description copied from interface: IStatement
      Fill script with object changes and return change type
      Specified by:
      appendAlterSQL in interface IStatement
      Parameters:
      newCondition - new object state
      script - script to collect changes
      Returns:
      object change type
    • compareColumns

      public boolean compareColumns(Collection<String> refs)
      Description copied from interface: IIndex
      Compares the columns of this index with a collection of column references.
      Specified by:
      compareColumns in interface IIndex
      Parameters:
      refs - the collection of column references to compare against
      Returns:
      true if the columns match in order and count
    • appendFullName

      public void appendFullName(StringBuilder sb)
    • setColumnstore

      public void setColumnstore(boolean isColumnstore)
    • addOrderCol

      public void addOrderCol(String orderCol)
      Adds a column to the ORDER clause for columnstore indexes.
      Parameters:
      orderCol - the column specification for ordering
    • setTablespace

      public void setTablespace(String tablespace)
    • setWhere

      public void setWhere(String where)
    • setClustered

      public void setClustered(boolean isClustered)
    • setUnique

      public void setUnique(boolean unique)
    • getOptions

      public Map<String,String> getOptions()
      Description copied from interface: IOptionContainer
      Gets all options for this container.
      Specified by:
      getOptions in interface IOptionContainer
      Returns:
      a map of option keys to values
    • addOption

      public void addOption(String key, String value)
      Description copied from interface: IOptionContainer
      Adds an option to this container.
      Specified by:
      addOption in interface IOptionContainer
      Parameters:
      key - the option key
      value - the option value
    • isClustered

      public boolean isClustered()
    • addColumn

      public void addColumn(SimpleColumn column)
      Description copied from interface: ISimpleColumnContainer
      Adds a column reference to this container.
      Specified by:
      addColumn in interface ISimpleColumnContainer
      Parameters:
      column - the simple column to add
    • addInclude

      public void addInclude(String include)
      Description copied from interface: ISimpleColumnContainer
      Adds an included column to this container.
      Specified by:
      addInclude in interface ISimpleColumnContainer
      Parameters:
      include - the column name to include
    • getTablespace

      public String getTablespace()
    • isUnique

      public boolean isUnique()
      Specified by:
      isUnique in interface IIndex
      Returns:
      true if unique index
    • computeHash

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Parameters:
      hasher - the hasher instance to use for hash computation
    • compare

      public boolean compare(IStatement obj)
      Description copied from class: AbstractStatement
      This method does not account for nested child PgStatements. Shallow version of AbstractStatement.equals(Object)
      Specified by:
      compare in interface IStatement
      Overrides:
      compare in class AbstractStatement