Cursor Functions
As explained in the searches section, a
cursor
is used to navigate through a group of records satisfying the search criteria on a specified index. The functionmco_uda_lookup()
positions the cursor at the first object that satisfies the search criteria.To initialize a cursor based on the
index_no
:MCO_RET mco_uda_cursor( mco_trans_h t, unsigned short struct_no, unsigned short index_no, /* out */ mco_cursor_t * cursor );To position the cursor at the first object that satisfies the search criteria:
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 );The object handle can then be received using:
MCO_RET mco_uda_from_cursor( mco_trans_h t, const mco_cursor_t * cursor, /* out */ mco_uda_object_handle_t * obj );To obtain information about the index associated with the cursor use:
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 );To position the cursor in the index referenced by
index_no
at a specific object use: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 );To compare the value(s) referenced by the current position of the index cursor with value(s) supplied by the application use:
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 );