UDA 游标函数
正如“搜索”部分所解释的那样,游标用于在满足指定索引上搜索条件的一组记录中进行导航。函数 mco_uda_lookup() 将游标定位在满足搜索条件的第一个对象上。
要根据索引编号初始化游标:
MCO_RET mco_uda_cursor(
mco_trans_h t,
unsigned short struct_no,
unsigned short index_no,
/* out */ mco_cursor_t * cursor
);要将光标定位到满足搜索条件的第一个对象处:
MCO_RET mco_uda_lookup(
mco_trans_h t,
unsigned short struct_no,
unsigned short index_no,
MCO_OPCODE op,
const mco_uda_value_t * keys,
unsigned short keys_count,
/* out */ mco_cursor_t * cursor
);然后可以使用以下方式接收对象句柄:
MCO_RET mco_uda_from_cursor(
mco_trans_h t,
const mco_cursor_t * cursor,
/* out */ mco_uda_object_handle_t * obj
);要获取与游标关联的索引的信息,请使用:
MCO_RET mco_uda_cursor_info( mco_trans_h t,
const mco_metadict_header_t * metadict,
const mco_cursor_t * cursor,
/* out */ unsigned short * dict_no,
/* out */ unsigned short * struct_no,
/* out */ unsigned short * index_no );若要将光标定位在由 index_no 引用的索引中的特定对象处,请使用:
MCO_RET mco_uda_locate( mco_trans_h t,
const mco_uda_object_handle_p obj,
unsigned short index_no,
/* out */ mco_cursor_t * cursor );要将索引游标当前所指位置的值与应用程序提供的值进行比较,请使用:
MCO_RET mco_uda_compare( mco_trans_h t,
const mco_cursor_t * cursor,
const mco_uda_value_t * keys,
unsigned short keys_count,
/* out */ int * cmp_result );