|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.h2.result.SortOrder
public class SortOrder
A sort order represents an ORDER BY clause in a query.
Field Summary | |
---|---|
static int |
ASCENDING
This bit mask means the values should be sorted in ascending order. |
static int |
DESCENDING
This bit mask means the values should be sorted in descending order. |
static int |
NULLS_FIRST
This bit mask means NULLs should be sorted before other data, no matter if ascending or descending order is used. |
static int |
NULLS_LAST
This bit mask means NULLs should be sorted after other data, no matter if ascending or descending order is used. |
Constructor Summary | |
---|---|
SortOrder(Database database,
int[] queryColumnIndexes,
int[] sortType,
java.util.ArrayList<SelectOrderBy> orderList)
Construct a new sort order object. |
Method Summary | |
---|---|
int |
compare(Value[] a,
Value[] b)
Compare two expression lists. |
static int |
compareNull(boolean aNull,
int sortType)
Compare two expressions where one of them is NULL. |
Column |
getColumn(int index,
TableFilter filter)
Get the column for the given table filter, if the sort column is for this filter. |
int[] |
getQueryColumnIndexes()
Get the column index list. |
int[] |
getSortTypes()
Get the sort order bit masks. |
java.lang.String |
getSQL(Expression[] list,
int visible)
Create the SQL snippet that describes this sort order. |
void |
sort(java.util.ArrayList<Value[]> rows)
Sort a list of rows. |
void |
sort(java.util.ArrayList<Value[]> rows,
int offset,
int limit)
Sort a list of rows using offset and limit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
public static final int ASCENDING
public static final int DESCENDING
public static final int NULLS_FIRST
public static final int NULLS_LAST
Constructor Detail |
---|
public SortOrder(Database database, int[] queryColumnIndexes, int[] sortType, java.util.ArrayList<SelectOrderBy> orderList)
database
- the databasequeryColumnIndexes
- the column index listsortType
- the sort order bit masksorderList
- the original query order list (if this is a query)Method Detail |
---|
public java.lang.String getSQL(Expression[] list, int visible)
list
- the expression listvisible
- the number of columns in the select list
public static int compareNull(boolean aNull, int sortType)
aNull
- whether the first expression is nullsortType
- the sort bit mask to use
public int compare(Value[] a, Value[] b)
compare
in interface java.util.Comparator<Value[]>
a
- the first expression listb
- the second expression list
public void sort(java.util.ArrayList<Value[]> rows)
rows
- the list of rowspublic void sort(java.util.ArrayList<Value[]> rows, int offset, int limit)
rows
- the list of rowsoffset
- the offsetlimit
- the limitpublic int[] getQueryColumnIndexes()
For the query "select name, id from test order by id, name" this is {1, 0} as the first order by expression (the column "id") is the second column of the query, and the second order by expression ("name") is the first column of the query.
public Column getColumn(int index, TableFilter filter)
index
- the column index (0, 1,..)filter
- the table filter
public int[] getSortTypes()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |