int db::Table::set_sort_order ( const NameChar *  index,
Order  new_order = DB_ASCENDING,
CursorMode  cursor_mode = DB_CURSOR_FOR_READ,
TxIsolation  isolation = DB_DEFAULT_ISOLATION 
)

Select an index to use when sorting and searching the table.

The selected index determines the order by which to sort the rows in the table when calling seek_first, seek_last. seek_next, and seek_prior. This index is also used when apply_seek is called to search for a row and when apply_range is used to restrict the set of accessible rows. Only one index can be active at a time.

If no index is selected, rows are sorted in an undefined order. Also, begin_seek, set_range_start, and set_range_end require that an index be selected.

Parameters:
index The name of the index to sort by. Use NULL to clear the sort order. (required)
new_order Order by which to sort. When DB_DESCENDING is chosen, the table cursor behaves as though the index were sorted in the opposite order.
cursor_mode Cursor mode to use while sorting by this index.
isolation Isolation level to use while sorting by this index.
Returns:
Precondition:
The table must be in DB_TABLE_BROWSING mode.
See also:
seek_first, seek_last, seek_next, seek_prior, apply_seek, apply_range


Copyright © 2005-2008 ITTIA®. All rights reserved.