Return the size (length) of a vector or array.
MCO_RET mco_uda_length( /*IN*/ mco_uda_object_handle_t * obj,
/*IN*/ unsigned short field_no,
/*OUT*/ unsigned short * dimension);
|
obj |
The address of a |
|
field_no |
The field number (must be between 0 to |
|
dimension |
The address of a variable to receive the length (number of elements) of the vector or array |
Return the length (number of elements) of the vector or array field.
| MCO_S_OK | The cursor was returned successfully |
| MCO_E_UDA_FIELD_NOT_FOUND | Invalid field_no |
|
MCO_E_UDA_SCALAR |
The field is not a vector or array |
Application snippet:
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);
}
}