Return an index descriptor.
MCO_RET mco_dict_index( /*IN*/ mco_metadict_header_t * metadict,
/*IN*/ unsigned short dict_no,
/*IN*/ unsigned short struct_no,
/*IN*/ unsigned short index_no,
/*OUT*/ mco_dict_index_info_t * index_info );
metadict
dict_no
mco_metadict_count() - 1).struct_no
mco_dict_struct_count() - 1).index_no
struct_info.index_count - 1).index_info
mco_dict_index_info_t variable to receive the index descriptor.This function returns an index descriptor by
index_no.
MCO_S_OK
MCO_E_UDA_STRUCT_NOTFOUND
struct_no.MCO_E_UDA_STRUCT_NOT_CLASS
struct_no does not correspond to a class.MCO_E_UDA_INDEX_NOTFOUND
index_no.
Application snippet:
const char * dbname = "SimpleDb";
int main(int argc, char* argv[])
{
MCO_RET rc;
unsigned int dict_no = 0;
unsigned int count;
mco_metadict_header_t *header;
const char * name = "MyClass";
mco_dict_struct_info_t struct_info;
...
header = (mco_metadict_header_t *) malloc(size);
mco_metadict_init(header, size); /* initialize the metadict */
...
rc = mco_dict_struct_name(header, dict_no, name, &struct_info);
for (i = 0; i < struct_info.index_count; ++i)
{
mco_dict_index_info_t index_info;
/* get index descriptor */
rc = mco_dict_index(header, dict_no, struct_info.struct_no, i, &index_info);
printf("Index %d : %s\n", i, index_info.name);
}
...
}