mco_cursor_next
接口适用于实时数据库 RT 。
将游标定位到索引中的下一个对象。
此函数将光标定位到索引中的下一个对象。列表光标将定位到任意排序的对象列表中的下一个对象。树形索引光标将定位到按索引排序的列表中的下一个对象。
MCO_RET mco_cursor_next(
/*IN*/ mco_trans_h t,
/*INOUT*/ mco_cursor_h c
);
参数
t
mco_trans_h
由 mco_trans_start()
函数返回的 mco_trans_h
事务句柄。
c
mco_cursor_h
从游标或索引搜索函数返回的游标句柄。
返回
MCO_S_OK
已成功定位游标。
MCO_S_CURSOR_END
游标到达列表的末尾。
MCO_E_CURSOR_INVALID
无效的游标句柄。
MCO_ERR_CURSOR
致命游标错误。
示例
/* 应用程序代码片段 */
const char * dbname = "SimpleDb";
int main(int argc, char* argv[])
{
mco_db_h db;
MCO_RET rc;
mco_device_t dev;
mco_db_params_t db_params;
mco_trans_h t;
mco_cursor_t c;
MCO_CURSOR_TYPE ctype;
...
rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
if ( MCO_S_OK != rc )
{
rc = mco_db_connect( dbname, &db );
...
rc = mco_trans_start(db, MCO_READ_ONLY, MCO_TRANS_FOREGROUND, &t);
if ( MCO_S_OK == rc )
{
...
A_list_cursor( t, &c);
for ( rc = mco_cursor_first( t, &c ); MCO_S_OK == rc; rc = mco_cursor_next( t, &c ) )
{
// Do something with the object at this cursor position
...
}
...
}
}
...
}
文件
- 头文件:
mco.h
- 源文件:
mcocsr.c
- 库:
libmcolib.a