Return an index field descriptor.
MCO_RET mco_dict_ifield( /*IN*/ mco_metadict_header_t * metadict,
/*IN*/ unsigned short dict_no,
/*IN*/ unsigned short struct_no,
/*IN*/ unsigned short index_no,
/*IN*/ unsigned short ifield_no,
/*OUT*/ mco_dict_ifield_info_t * ifield_info );
| metadict | The address of an initialized mco_metadict_header_t structure |
|
dict_no |
The number of the dictionary (must be between 0 and |
|
struct_no |
The structure/class number (must be between 0 and |
|
index_no |
The index number (must be between 0 and |
|
ifield_no |
The compound index field (segment) number (0 and |
|
ifield_info |
The address of a |
This function returns a compound index field (segment) descriptor by index field number
ifield_no.
Application snippet:
const char * dbname = "SimpleDb";
int main(int argc, char* argv[])
{
MCO_RET rc;
unsigned int dict_no = 0;
unsigned int struct_no = 0;
unsigned int index_no = 0;
unsigned int count;
mco_metadict_header_t *header;
mco_dict_index_info_t index_info;
...
header = (mco_metadict_header_t *) malloc(size);
mco_metadict_init(header, size); /* initialize the metadict */
...
rc = mco_dict_index(header, dict_no, struct_no, index_no, &index_info);
for (i = 0; i < index_info.n_fields; ++i)
{
mco_dict_ifield_info_t ifield_info;
mco_dict_field_info_t field_info;
/* get index field descriptor */
rc = mco_dict_ifield(header, dict_no, struct_no, index_no, i, &ifield_info);
rc = mco_dict_field(header, dict_no, struct_no, ifield_info.field_no, &field_info);
printf("Compound index field %d : %s\n", i, field_info.name);
}
...
}