mco_db_clean

Remove all objects from a database.

Prototype

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

Arguments

db The database handle that was established by mco_db_connect()

Description

This function removes all objects from an opened database.

Return Codes

MCO_S_OK The database was successfully cleaned - all objects removed
MCO_E_INVALID_HANDLE Invalid database connection
MCO_E_ILLEGAL_PARAM Unable to remap segments; memory device is not conventional memory, memory size is zero or no memory allocated

MCO_E_DISK_NOT_OPENED

An index for a persistent class could not be deleted because disk access was not initialized by db_open_dev()

MCO_E_PAGESIZE

Unable to re-initialize database; Invalid database page size

MCO_E_NOMEM

Not enough memory to re-initialize database

MCO_ERR_DB_NOMEM

Fatal error: out of memory while re-initializing database

MCO_ERR_INDEX

Fatal error: unable to create index

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_connect(  dbname, &db );
            ...
            rc = mco_db_clean( db );

            ...
        }
    }
 

Files

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