list cursor
此函数创建一个列表游标,供后续的游标导航方法使用。列表游标以任意顺序遍历某个类的对象。
MCO_RET classname_list_cursor(
/*IN*/ mco_trans_h trans,
/*OUT*/ mco_cursor_h cursor
);
参数
trans
mco_trans_h
由 mco_trans_start()
函数返回的 MCO_READ_WRITE
事务句柄。
cursor
mco_cursor_h
一个待准备的 mco_cursor_h
实例。
返回
MCO_S_OK
创建游标成功。
MCO_S_CURSOR_EMPTY
该类中没有对象。
MCO_ERR_DICT
字典错误。
MCO_ERR_CURSOR
游标特定错误。
示例
/* start read-only transaction and initialize cursor in it. */
mco_trans_start( db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &trn );
/* initialize cursor */
SimpleClass_list_cursor ( trn, &csr );
if (rc != MCO_S_OK)
{
/* if not found for whatever reason - close the transaction and
* bail out */
mco_trans_commit(trn);
return;
}
/* commit the transaction. This is only done to illustrate the fact that
* cursors could be used across the transaction boundaries */
rc = mco_trans_commit(trn);