mco_db_open_disk

This function creates or opens a persistent database. This function is provided for compatibility with eXtremeDB version 3.5. It replaces the combination of mco_db_open() and mco_disk_open() (deprecated function calls). For applications using version 4.0 and later, use mco_db_open_dev().

Prototype

    MCO_RET mco_db_open(/*IN*/ const char *dbname,
                 /*IN*/ mco_dictionary_h dict,
                 /*IN*/ void *mem_ptr,
                 /*IN*/ mco_size_t mem_size,
                 /*IN*/ mco_size_t mem_page_size,
                 /*IN*/ const char *db_file_path,
                 /*IN*/ const char *log_file_path,
                 /*IN*/ void *disk_cache_ptr,
                 /*IN*/ mco_size_t disk_cache_size,
                 /*IN*/ mco_size_t disk_page_size,
                 /*IN*/ mco_offs_t max_database_size,
                 /*IN*/ MCO_LOG_TYPE log_type);

Arguments

dbname
The name of the database to open. Taken from the declare database dbname DDL statement. Note that the maximum database name length is 16 characters.
dict
A handle to the dictionary that was created by the eXtremeDB schema compiler mcocomp. Normally, this handle is passed in by dbname_get_dictionary().
mem_ptr
Conventional memory address for database meta-data.
mem_size
Size of conventional memory portion.
mem_page_size
Size of database pages.
db_file_path
Database data file path.
log_file_path
Database log file path.
disk_cache_ptr
Conventional memory address for disk cache.
disk_cache_size
Size of disk cache.
disk_page_size
Size of disk cache pages.
max_database_size
Maximum size of the database.
log_type
Database log type.

Description

This function creates the database dbname according to the parameters specified.

Return Codes

MCO_S_OK
The database was created/opened successfully.
MCO_E_ILLEGAL_PARAM
Illegal combination of database parameters. No memory segment for the database or no persistent or cache segments for the database.
MCO_E_NOMEM
Not enough memory allocated. (e.g., not enough memory to create indexes).
MCO_E_INSTANCE_DUPLICATE
Duplicate db instance, i.e. attempt to open a database with the same name as a currently open database.
MCO_E_SHM_ERROR
An error occurred when attempting to create, truncate or close a shared memory segment.
MCO_E_INMEM_ONLY_RUNTIME
The database dictionary contains persistent objects but the application is linked with the in-memory runtime libraries.
MCO_ERR_DB_NAMELONG
Database name longer than 16 characters.
MCO_E_DISK_INVALID_PARAM
Disk database creation parameters are invalid.
MCO_E_DISK_ALREADY_OPENED
The disk device specified is already opened.

Example

If example code demonstrating how to use this function is required, please contact McObject Support by clicking on the "Send Feedback" link below.

    No example code provided.

Files

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