CacheGlobalOrder example to iterate over global and get data
I managed to use CacheGlobalOrder to iterate over global and return the next subscript:
int GetGlobalStr(char *global, int subscript, CACHE_EXSTRP result)
{
int push = CACHEPUSHGLOBAL(strlen(global), global);
int pushS = CACHEPUSHINT(subscript);
// narg Number of subscript expressions pushed onto the argument stack.
int narg = 1;
// Direction for the $Order is 1 for forward, -1 for reverse.
int dir = 1;
// Indicates whether the data value, if there is one, should be returned.
int valueflag = 0;
int order = CACHEGLOBALORDER(narg, dir, valueflag);
int pop = CACHEPOPEXSTR(result);
//pop = CACHEPOPEXSTR(result);
return ZF_SUCCESS;
}
I'm using valueflag = 0. so data is not returned, only next subscript. However, it I set valueflag to 1 I don't receive global data or next subscript, only 1 or 0 depending on whenever next key exists.