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 | The address of a mco_metadict_header_t structure |
|
name |
The name of the dictionary - must be unique within this meta-dictionary |
|
dict |
The address of the dictionary, should be received via the generated
|
|
user_data |
The address of optional application-specific 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).
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);
...
}