Package org.h2.table
Class IndexColumn
java.lang.Object
org.h2.table.IndexColumn
This represents a column item of an index. This is required because some
indexes support descending sorted columns.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe column, or null if not set.final StringThe column name.intThe sort type.static final intDo not append ordering. -
Constructor Summary
ConstructorsConstructorDescriptionIndexColumn(String columnName) Creates a new instance with the specified name.IndexColumn(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
Modifier and TypeMethodDescriptiongetSQL(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.toString()static IndexColumn[]Create an array of index columns from a list of columns.static StringBuilderwriteColumns(StringBuilder builder, IndexColumn[] columns, int sqlFlags) Appends the specified columns to the specified builder.static StringBuilderwriteColumns(StringBuilder builder, IndexColumn[] columns, int startOffset, int endOffset, int sqlFlags) Appends the specified columns to the specified builder.static StringBuilderwriteColumns(StringBuilder builder, IndexColumn[] columns, String separator, String suffix, int sqlFlags) Appends the specified columns to the specified builder.
-
Field Details
-
SQL_NO_ORDER
public static final int SQL_NO_ORDERDo not append ordering.- See Also:
-
columnName
The column name. -
column
The column, or null if not set. -
sortType
public int sortTypeThe sort type. Ascending (the default) and descending are supported; nulls can be sorted first or last.
-
-
Constructor Details
-
IndexColumn
Creates a new instance with the specified name.- Parameters:
columnName- the column name
-
IndexColumn
Creates a new instance with the specified name.- Parameters:
columnName- the column namesortType- the sort type
-
IndexColumn
Creates a new instance with the specified column.- Parameters:
column- the column
-
-
Method Details
-
writeColumns
public static StringBuilder writeColumns(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 StringBuilder writeColumns(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 StringBuilder writeColumns(StringBuilder builder, IndexColumn[] columns, String separator, 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
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
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
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
-