Ordering of a table by some ascending or descending columns. More...
#include <sqludr.h>
Public Types | |
enum | OrderTypeCode { NO_ORDER, ASCENDING, DESCENDING } |
Ascending/descending order of columns. More... | |
Public Member Functions | |
int | getNumEntries () const |
int | getColumnNum (int i) const |
OrderTypeCode | getOrderType (int i) const |
void | addEntry (int colNum, OrderTypeCode orderType=ASCENDING) |
void | addEntryAt (int pos, int colNum, OrderTypeCode orderType=ASCENDING) |
void | clear () |
Ordering of a table by some ascending or descending columns.
A list of columns, represented by column numbers, with an ascending/descending indicator for each column.
Ascending/descending order of columns.
For outputs, the ordering of values from the first row out to the last. Note that this ordering applies within a parallel instance of the UDF at runtime, but it does not guarantee a total order. For example, two parallel instances may get these ordered values: instance 0 gets 1,3,5,7 instance 1 gets 2,4,6,8
void OrderInfo::addEntry | ( | int | colNum, | |
OrderTypeCode | orderType = ASCENDING | |||
) |
Append an entry to the ordering.
colNum | Column number to append to the ordering. | |
orderType | Order type (ascending or descending) to use. |
void OrderInfo::addEntryAt | ( | int | pos, | |
int | colNum, | |||
OrderTypeCode | orderType = ASCENDING | |||
) |
Insert an entry at any position of the ordering.
A quick example to illustrate this: Let's say we have a table with columns (a,b,c). Their column numbers are 0, 1, and 2. We produce an ordering (C ASCENDING):
OrderInfo myorder; myorder.addEntryAt(0, 2);
Next, we want to make this into (B DESCENDING, C ASCENDING):
myorder.addEntryAt(0, 1, DESCENDING);
pos | Position (0-based) at which we want to insert. The new entry will be position "pos" after the insertion, any existing entries will be moved up. | |
colNum | Number of the column by which we want to order | |
orderType | Order type (ascending or descending) to use |
UDRException |
void OrderInfo::clear | ( | ) |
Clear the contents of the object
int OrderInfo::getColumnNum | ( | int | i | ) | const |
Get the column number of an entry of the ordering.
i | the position (0-based) of the ordering, 0 meaning the leading position. |
UDRException |
int OrderInfo::getNumEntries | ( | ) | const |
Get the number of entries (columns) in the ordering.
OrderInfo::OrderTypeCode OrderInfo::getOrderType | ( | int | i | ) | const |
Get the order type of an entry of the ordering.
i | the position (0-based) of the ordering, 0 meaning the leading position. |
UDRException |