Package org.h2.table
Class IndexColumn
- java.lang.Object
-
- org.h2.table.IndexColumn
-
public class IndexColumn extends java.lang.ObjectThis 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 ColumncolumnThe column, or null if not set.java.lang.StringcolumnNameThe column name.intsortTypeThe sort type.static intSQL_NO_ORDERDo 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.StringBuildergetSQL(java.lang.StringBuilder builder, int sqlFlags)Appends the SQL snippet for this index column to the specified string builder.static voidmapColumns(IndexColumn[] indexColumns, Table table)Map the columns using the column names and the specified table.java.lang.StringtoString()static IndexColumn[]wrap(Column[] columns)Create an array of index columns from a list of columns.static java.lang.StringBuilderwriteColumns(java.lang.StringBuilder builder, IndexColumn[] columns, int sqlFlags)Appends the specified columns to the specified builder.static java.lang.StringBuilderwriteColumns(java.lang.StringBuilder builder, IndexColumn[] columns, int startOffset, int endOffset, int sqlFlags)Appends the specified columns to the specified builder.static java.lang.StringBuilderwriteColumns(java.lang.StringBuilder builder, IndexColumn[] columns, java.lang.String separator, java.lang.String suffix, int sqlFlags)Appends the specified columns to the specified builder.
-
-
-
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 namesortType- 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 buildercolumns- index columnssqlFlags- 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 builderstartOffset- start offset, inclusiveendOffset- end offset, exclusivecolumns- index columnssqlFlags- 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 buildercolumns- index columnsseparator- separatorsuffix- additional SQL to append after each columnsqlFlags- 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 buildersqlFlags- 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 settable- the table from where to map the column names to columns
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-