mco_uda_locate
MCO_RET mco_uda_locate( /*IN*/ mco_trans_h t,
/*IN*/ unsigned short struct_no,
/*IN*/ unsigned short index_no,
/*OUT*/ mco_cursor_t * cursor );
| |
---|
t | 事务处理 |
struct_no | |
index_no | 索引号(必须介于 0 和 - 1 之间)struct_info.index_count |
cursor | 包含已初始化游标的结构的地址mco_cursor_t |
将光标定位在给定对象处index_no引用的索引中。
| |
---|
MCO_S_OK | 当前光标位置已成功移动到指定对象 |
MCO_E_UDA_STRUCT_NOT_CLASS | 无效的对象句柄:指向结构,而不是对象 |
MCO_E_UDA_INDEX_NOTFOUND | 无效index_no |
/* 应用程序代码片段 */
int main(int argc, char** argv)
{
MCO_RET rc;
mco_db_h db;
mco_trans_h t;
mco_cursor_t cursor;
unsigned short struct_no = 1;
unsigned short index_no = 5;
...
rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t);
if ( MCO_S_OK == rc )
{
rc = mco_uda_cursor(t, struct_no, index_no, &cursor);
for ( ; rc == MCO_S_OK; rc = mco_cursor_next(t, &cursor))
{
mco_uda_object_handle_t obj;
/* get object handle */
mco_uda_from_cursor(t, &cursor, &obj);
mco_uda_locate(t, &obj, index_no, &cursor);
...
}
rc = mco_trans_rollback(t);
}
}