SaCursorOrderbyVector is used to specify the order of columns used in a search.
The initial values are used as a vector of values to specify the starting position for the search in the key. The initial value is used only for the starting point selection in the key; after that, the initial values are not checked against the column values. If several criteria are given, they are solved in the given order. A proper key must exist for the ordering.
The initial value is taken from the user variable bound to the column.
/* These variables will be bound to the columns named "I" and "J" */ int i, j; /* Bind variables to columns in this cursor. */ SaCursorColStr(scur, "I", ’i); SaCursorColStr(scur, "J", ’j); /* Set the values that we want to use in the search. */ i = 2; j = 1; /* Specify the order of the columns. */ SaCursorOrderByVector(scur, "I"); SaCursorOrderByVector(scur, "J"); /* Search the cursor for matching values. */ SaCursorSearch(scur);
The preceding would be the equivalent of the following SQL WHERE clause: