This function is deprecated in eXtremeDB version 4.0 and later. It is retained for backward compatibility with in-memory only database applications written for previous versions of the eXtremeDB runtime. For applications using eXtremeDB version 4.0 and later, the recommended database open API is
mco_db_open_dev().
MCO_RET mco_db_open(/*IN*/ const char *dbname,
/*IN*/ mco_dictionary_h dict,
/*IN*/ void *mem,
/*IN*/ uint4 total_size,
/*IN*/ uint2 page_size);
dbname
declare database dbname DDL statement. Note
that the maximum database name length is 16 characters.dict
mcocomp. Normally, this
handle is passed in by dbname_get_dictionary().mem
total_size
mem.page_size
mem that will be managed by the page manager.This function creates the database
dbnamein the space referenced bymemwith an initial size oftotal_size(the database size can be extended) and with a page size ofpage_size.
MCO_S_OK
MCO_E_PAGESIZE
MCO_E_NOMEM
MCO_E_INSTANCE_DUPLICATE
MCO_ERR_DB_VERS_MISMATCH
MCO_ERR_DB_NOMEM
MCO_ERR_DB_NAMELONG
Application snippet:
const char *dbname = "SimpleDb";
int main(int argc, char* argv[])
{
mco_db_h db;
MCO_RET rc;
char *mem = malloc(DBSIZE);
if ((rc = mco_runtime_start()) != MCO_S_OK)
exit(-1);
rc = mco_db_open(dbname, simpledb_get_dictionary(), mem, DBSIZE, (uint2)PAGESIZE);
...
}