Register a database dictionary in the meta-dictionary.
MCO_RET mco_metadict_register( /*IN*/ mco_metadict_header_t * metadict,
/*IN*/ const char * name,
/*IN*/ const void * dict,
/*IN*/ const void * user_data);
metadict
name
dict
<database-name>_get_dictionary().user_data
The API registers a database dictionary in the meta-dictionary. Note that
mco_metadict_init()automatically registers open conventional memory databases. If the database is opened after the metadictionary is initialized, it can be registered explicitly with this API. It is possible to register database dictionaries before opening the database, or without opening the database (for example, the application might need to just receive the specific schema (dictionary) information).
MCO_S_OK
MCO_E_UDA_NAME_TOO_LONG
MCO_E_UDA_DUPLICATE
Application snippet:
const char * dbname = "SimpleDb";
int main(int argc, char* argv[])
{
MCO_RET rc;
unsigned int size;
mco_metadict_header_t *header;
mco_metadict_size(10, &size); /* figure out the buffer size to
register 10 database dictionaries */
...
header = (mco_metadict_header_t *) malloc(size);
mco_metadict_init(header, size); /* initialize the metadict */
...
rc = mco_metadict_register(header, "test_db", mydb_get_dictionary(),
&custom_data);
...
}