mco_db_disconnect

Disconnect from a database.

Prototype

        MCO_RET mco_db_disconnect(/*IN*/ mco_db_h db);

Arguments

db
The database handle that was established by mco_db_connect().

Description

This function destroys the connection handle to the database and invalidates any existing transaction handles for the connection. The function verifies that there are no active transactions associated with the session being disconnected and returns non-fatal error MCO_E_TRANS_NOT_CLOSED otherwise.

Return Codes

MCO_S_OK
The database connection was disconnected successfully.
MCO_E_TRANS_NOT_CLOSED
There are active transactions associated with the session being disconnected.

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;
            ...

            rc = mco_db_open_dev(dbname, simpledb_get_dictionary(), &dev, 1, &db_params);

            if (MCO_S_OK != rc)
            {
                rc = mco_db_connect(dbname, &db);
                ...
                rc = mco_db_disconnect(db);

                rc = mco_db_close(dbname);
                ...
            }
        }

Files

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