mco_uda_length
MCO_RET mco_uda_length( /*IN*/ mco_uda_object_handle_t * obj,
/*IN*/ unsigned short field_no,
/*OUT*/ unsigned short * dimension);
| |
---|
obj | 包含 UDA 对象的结构的地址mco_uda_object_handle_t |
field_no | 字段编号(必须介于 0 到 - 1 之间)struct_info.field_count |
dimension | 用于接收向量或数组的长度(元素数)的变量的地址 |
返回 vector 或 array 字段的长度(元素数)。
| |
---|
MCO_S_OK | 已成功返回游标 |
MCO_E_UDA_FIELD_NOT_FOUND | 无效field_no |
MCO_E_UDA_SCALAR | 字段不是向量或数组 |
/* 应用程序代码片段 */
int main(int argc, char** argv)
{
MCO_RET rc;
mco_db_h db;
mco_trans_h t;
mco_cursor_t cursor;
unsigned short field_no = 1;
unsigned short struct_no = 1;
unsigned short index_no = 5;
unsigned short length;
...
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_length(&obj, field_no, &length);
...
}
rc = mco_trans_rollback(t);
}
}