Package org.h2.table

Class IndexColumn


  • public class IndexColumn
    extends java.lang.Object
    This represents a column item of an index. This is required because some indexes support descending sorted columns.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      Column column
      The column, or null if not set.
      java.lang.String columnName
      The column name.
      int sortType
      The sort type.
      static int SQL_NO_ORDER
      Do not append ordering.
    • Constructor Summary

      Constructors 
      Constructor Description
      IndexColumn​(java.lang.String columnName)
      Creates a new instance with the specified name.
      IndexColumn​(java.lang.String columnName, int sortType)
      Creates a new instance with the specified name.
      IndexColumn​(Column column)
      Creates a new instance with the specified column.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.StringBuilder getSQL​(java.lang.StringBuilder builder, int sqlFlags)
      Appends the SQL snippet for this index column to the specified string builder.
      static void mapColumns​(IndexColumn[] indexColumns, Table table)
      Map the columns using the column names and the specified table.
      java.lang.String toString()  
      static IndexColumn[] wrap​(Column[] columns)
      Create an array of index columns from a list of columns.
      static java.lang.StringBuilder writeColumns​(java.lang.StringBuilder builder, IndexColumn[] columns, int sqlFlags)
      Appends the specified columns to the specified builder.
      static java.lang.StringBuilder writeColumns​(java.lang.StringBuilder builder, IndexColumn[] columns, int startOffset, int endOffset, int sqlFlags)
      Appends the specified columns to the specified builder.
      static java.lang.StringBuilder writeColumns​(java.lang.StringBuilder builder, IndexColumn[] columns, java.lang.String separator, java.lang.String suffix, int sqlFlags)
      Appends the specified columns to the specified builder.
      • Methods inherited from class java.lang.Object

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

      • SQL_NO_ORDER

        public static final int SQL_NO_ORDER
        Do not append ordering.
        See Also:
        Constant Field Values
      • columnName

        public final java.lang.String columnName
        The column name.
      • column

        public Column column
        The column, or null if not set.
      • sortType

        public int sortType
        The sort type. Ascending (the default) and descending are supported; nulls can be sorted first or last.
    • Constructor Detail

      • IndexColumn

        public IndexColumn​(java.lang.String columnName)
        Creates a new instance with the specified name.
        Parameters:
        columnName - the column name
      • IndexColumn

        public IndexColumn​(java.lang.String columnName,
                           int sortType)
        Creates a new instance with the specified name.
        Parameters:
        columnName - the column name
        sortType - the sort type
      • IndexColumn

        public IndexColumn​(Column column)
        Creates a new instance with the specified column.
        Parameters:
        column - the column
    • Method Detail

      • writeColumns

        public static java.lang.StringBuilder writeColumns​(java.lang.StringBuilder builder,
                                                           IndexColumn[] columns,
                                                           int sqlFlags)
        Appends the specified columns to the specified builder.
        Parameters:
        builder - string builder
        columns - index columns
        sqlFlags - formatting flags
        Returns:
        the specified string builder
      • writeColumns

        public static java.lang.StringBuilder writeColumns​(java.lang.StringBuilder builder,
                                                           IndexColumn[] columns,
                                                           int startOffset,
                                                           int endOffset,
                                                           int sqlFlags)
        Appends the specified columns to the specified builder.
        Parameters:
        builder - string builder
        startOffset - start offset, inclusive
        endOffset - end offset, exclusive
        columns - index columns
        sqlFlags - formatting flags
        Returns:
        the specified string builder
      • writeColumns

        public static java.lang.StringBuilder writeColumns​(java.lang.StringBuilder builder,
                                                           IndexColumn[] columns,
                                                           java.lang.String separator,
                                                           java.lang.String suffix,
                                                           int sqlFlags)
        Appends the specified columns to the specified builder.
        Parameters:
        builder - string builder
        columns - index columns
        separator - separator
        suffix - additional SQL to append after each column
        sqlFlags - formatting flags
        Returns:
        the specified string builder
      • getSQL

        public java.lang.StringBuilder getSQL​(java.lang.StringBuilder builder,
                                              int sqlFlags)
        Appends the SQL snippet for this index column to the specified string builder.
        Parameters:
        builder - string builder
        sqlFlags - formatting flags
        Returns:
        the specified string builder
      • wrap

        public static IndexColumn[] wrap​(Column[] columns)
        Create an array of index columns from a list of columns. The default sort type is used.
        Parameters:
        columns - the column list
        Returns:
        the index column array
      • mapColumns

        public static void mapColumns​(IndexColumn[] indexColumns,
                                      Table table)
        Map the columns using the column names and the specified table.
        Parameters:
        indexColumns - the column list with column names set
        table - the table from where to map the column names to columns
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object