2bfbf22005-04-10Martin Nilsson 
6b43202005-04-10Martin Nilsson #pike __REAL_VERSION__
2bfbf22005-04-10Martin Nilsson inherit .sql_result; array master_res; void create(array res) { if(!res || !arrayp(res))
6b43202005-04-10Martin Nilsson  error("Bad argument.\n"); master_res = res;
2bfbf22005-04-10Martin Nilsson } int num_rows() { return sizeof(master_res); } int num_fields() { return sizeof(master_res[0]); } int eof() { return index >= sizeof(master_res); }
6b43202005-04-10Martin Nilsson // Only supports the name field.
2bfbf22005-04-10Martin Nilsson array(mapping(string:mixed)) fetch_fields() { array(mapping(string:mixed)) res = allocate(sizeof(master_res[0])); int i; foreach(sort(indices(master_res[0])), string name) res[i++] = ([ "name": name ]); return res; } void seek(int skip) {
6b43202005-04-10Martin Nilsson  if(skip<0) error("Skip argument not positive.\n");
2bfbf22005-04-10Martin Nilsson  index += skip; } int|array(string|int) fetch_row() { array res;
3524712015-05-26Martin Nilsson 
2bfbf22005-04-10Martin Nilsson  if (index >= sizeof(master_res)) return 0; sort(indices(master_res[index]), res = values(master_res[index])); index++; return res; }