mco_db_close

Close a database.

Prototype

        MCO_RET mco_db_close(/*IN*/ const char *dbname);

Arguments

dbname
The name of the database to close. It is the same name given to mco_db_open().

Description

This function destroys the database dbname. The data is discarded. All handles to the database become invalid. The memory is not freed; it is the responsibility of the calling application to allocate and free the memory for databases.

Return Codes

MCO_S_OK
The database was closed successfully.
MCO_E_NOINSTANCE
The specified database is not opened.
MCO_E_OPENED_SESSIONS
There are open connections to the database. (Call mco_db_disconnect() for all open sessions first.)

Example


        Application snippet:

        const char *dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            mco_db_h db;
            MCO_RET rc;
            mco_device_t dev;
            mco_db_params_t db_params;
            ...

            if ((rc = mco_runtime_start()) != MCO_S_OK)
                exit(-1);

            rc = mco_db_open_dev(dbname, simpledb_get_dictionary(), &dev, 1, &db_params);
            if (MCO_S_OK != rc)
            {
                ...
                rc = mco_db_close(dbname);

                ...
            }
        }

Files

Header file:
mco.h
Source file:
mcodb.c
Library:
libmcolib.a