mco_uda_db_close

Close the database for UDA.

Prototype

 
    MCO_RET mco_uda_db_close(	/*IN*/const mco_metadict_header_t * metadict, 
                   /*IN*/ unsigned short dict_no );
 

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)

Description

This function closes the database referenced by the specified index dict_no. The data is discarded. All handles to the database become invalid. However, note that the database memory is not freed, it is the responsibility of the calling application to allocate and free the database memory.

Return Codes

MCO_S_OK Database closed successfully
MCO_E_NOINSTANCE Invalid database handle
MCO_E_OPENED_SESSIONS Database connections still open

Example

 
    Application snippet:
        
     
    const char * dbname = "SimpleDb";
     
    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        mco_runtime_info_t info;
        unsigned int dict_no = 0;
        unsigned int count;
        mco_metadict_header_t *header;
        mco_uda_class_storge patches[2];
 
        ...
        mco_runtime_start();
        mco_get_runtime_info(&info);
        ...
         
        header = (mco_metadict_header_t *) malloc(size);
        mco_metadict_init(header, size); /* initialize the metadict */
        ...
        /* change storage type */
        patches[0].class_code = get_class_code("InMem");
        patches[0].persistence = MCO_UDA_CLASS_TRANSIENT;
        patches[1].class_code = get_class_code("OnDisk");
        patches[1].persistence = ( info.mco_disk_supported) ? 
                        MCO_UDA_CLASS_PERSISTENT :
                        MCO_UDA_CLASS_TRANSIENT;
         
        /* open database */
        rc = mco_uda_db_open(metadict,   /* meta-dictionary header - must be initialized */
                     0,             /* dictionary number */
                    dev,            /* memory devices */
                    n_dev,          /* num of memory devices */
                    &db_params, /* db parameters */
                    patches,        /* class storage type overrides */
                    2);             /* number of storage type overrides */
        if (rc == MCO_S_OK) {
            ...
            /* close the database */
            mco_uda_db_close(metadict, 0);
        
        }
        ...
         
    }
     
 

Files

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