mco_dict_field_name

Return a field descriptor by name.

Prototype

    MCO_RET mco_dict_field_name(    /*IN*/ mco_metadict_header_t * metadict,
                    /*IN*/ unsigned short dict_no,
                    /*IN*/ unsigned short struct_no,
                    /*IN*/ const char * name,
                    /*OUT*/ mco_dict_field_info_t * field_info );

Arguments

metadict
The address of an initialized mco_metadict_header_t structure.
dict_no
The number of the dictionary (must be between 0 and mco_metadict_count() - 1).
struct_no
The structure/class number (must be between 0 and mco_dict_struct_count() - 1).
name
The field name as defined in the schema.
field_info
The address of a mco_dict_field_info_t variable to receive the field descriptor.

Description

This function returns a field descriptor referred to by name.

Return Codes

MCO_S_OK
The field descriptor was successfully returned.
MCO_E_UDA_DICT_NOTFOUND
The dictionary is not registered.
MCO_E_UDA_STRUCT_NOTFOUND
Invalid struct_no.
MCO_E_UDA_FIELD_NOTFOUND
Invalid field name specified.

Example

    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 count;
        mco_metadict_header_t *header;
        const char * field_name = "MyField";
        mco_dict_field_info_t field_info;
        ...

        header = (mco_metadict_header_t *) malloc(size);
        mco_metadict_init(header, size); /* initialize the metadict */
        ...
        /* get field descriptor */
        rc = mco_dict_field_name(header, dict_no, struct_no, field_name, &field_info);

        printf("Field %d : %s\n", field_info.field_no, field_name);
        ...
    }

Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a