# mco_inmem_load DEPRECATED

> Load transient (in-memory) classes from an external file. This function has been deprecated in version 7.1. See mco_db_load().

### Prototype

        MCO_RET	mco_inmem_load(	/*IN*/ void *stream_handle,
                      /*IN*/ mco_stream_read input_stream_reader,
                      /*IN*/ const char * dbname,
                      /*IN*/ mco_dictionary_h dict,
                      /*IN*/ mco_device_t *devices,
                      /*IN*/ uint2 n_devices,
                      /*IN*/ mco_db_params_t * db_params );

### Arguments

stream_handle | Handle to the input stream
input_stream_reader | Handler function called by the runtime to read the input
dbname | Database name passed to`mco_db_open_dev()`
dict | Database dictionary handle passed to `mco_db_open_dev().`
devices | Device structure array passed to`mco_db_open_dev()`
n_devices | The number of device structures passed to `mco_db_open_dev()`.
db_params | The database parameters passed to `mco_db_open_dev()`

### Description

> While`mco_db_load()` loads all database objects (both persistent and transient), this function reads the content of only the transient classes. For all-in-memory databases this function is equivalent to `mco_db_load()`, but for “hybrid” databases this allows the application to load only the transient objects in the database from a previously saved snapshot (see `mco_inmem_save()` ). After loading the transient classes this function opens the database by calling `mco_db_open_dev()` with the passed parameters.

> The calling application must provide a stream pointer (a pointer to a file, socket, pipe, etc.) and the address of a function that will perform the reading of the stream of bytes representing the database image. The eXtremeDBruntime will call the given function, passing it the stream pointer, a buffer and the size of the buffer to be read. See the control structure stream_reader for further details. (Also see `mco_inmem_save()`).

### Return Codes

MCO_S_OK | The database was closed successfully
MCO_E_NOINSTANCE | The specified database is not opened

### Example

        Application snippet:

        mco_size_sig_t file_reader( void *stream_handle /* FILE *  */,  /* OUT */void *to, mco_size_t max_nbytes )
        {
            FILE *f = (FILE *)stream_handle;
            mco_size_sig_t nbs;
            nbs = fread( to, 1, max_nbytes, f );
            return nbs;
        }

        int  main(int argc, char** argv)
        {
            MCO_RET             rc;
            sample_memory_t     dbmem;
            mco_db_h            db;
            mco_db_params_t     db_params;
            …
            FILE * fbak;
            …
            rc = mco_inmem_load( (void *)fbak, file_reader, dbname, backupdb_get_dictionary(), dbmem.dev, dbmem.n_dev, &db_params );

            fclose( fbak );
            sample_rc_check( "\t Load database", rc );
            if ( MCO_S_OK == rc )
            {
                /* Connect to database */
                rc = mco_db_connect( dbname, &db );
                sample_rc_check( "\t Connect to database", rc );
            }
        }