Perform a database lookup.
MCO_RET mco_uda_lookup( /*IN*/ mco_trans_h t, /*IN*/ unsigned short struct_no, /*IN*/ unsigned short index_no, /*IN*/ MCO_OPCODE op, /*IN*/ const mco_uda_value_t * keys, /*IN*/ unsigned short keys_count, /*OUT*/ mco_cursor_t * cursor );
t | The transaction handle |
struct_no |
The structure/class number (must be between 0 and |
index_no |
The index number (must be between 0 and |
op |
The opcode (MCO_LT, MCO_LE, MCO_EQ, MCO_GE, MCO_GT) Note that a hash index only allows MCO_EQ |
keys |
An array of search keys |
keys_count |
The length of the search keys array. Note that the number of keys, their order and types must correspond to the DDL description for the index |
cursor |
The cursor handle |
Perform a database lookup. The function positions the cursor at the first object that satisfies the search criteria. The object handle can then be received using the
mco_uda_from_cursor()
API.
Application snippet: int main(int argc, char* argv[]) { MCO_RET rc; mco_db_h db; mco_trans_h t; mco_cursor_t csr; mco_uda_value_t keys[1]; unsigned short struct_no = 1; unsigned short index_no = 2; mco_uda_object_handle_t uda_obj; ... rc = mco_trans_start(db, MCO_READ_WRITE, MCO_TRANS_FOREGROUND, &t); if ( MCO_S_OK == rc) { ... keys[0].type = MCO_DD_UINT4; keys[0].u4 = 120; /* Lookup the first object with id >= 120. */ rc = mco_uda_lookup(t, Record_struct_no, index_no, MCO_GE, keys, 1, &csr); if ( MCO_S_OK == rc) { mco_uda_from_cursor(t, &csr, &uda_obj); /* get the handle */ ... } } ... }