Directory
eXtremeDB_rt/samples/opendbDescription
Demonstrates opening a database using a conventional memory device.
Used API
mco_db_open_dev()Code snippet
/* Setup database memory device as a plain conventional memory region */ dev.type = MCO_MEMORY_CONV; /* Set the device as a conventional memory device */ dev.assignment = MCO_MEMORY_ASSIGN_DATABASE; /* Assign the device as main database memory */ dev.size = DATABASE_SEGMENT_SIZE; /* Set the device size */ dev.dev.conv.ptr = (char*)malloc( dev.size ); /* Allocate memory and set device pointer */ /* Initialize and customize the database parameters */ mco_db_params_init ( &db_params ); /* Initialize the params with default values */ db_params.mem_page_size = MEMORY_PAGE_SIZE; /* Set page size for the in-memory part */ db_params.disk_page_size = 0; /* Set page size to zero to disable disk operations */ db_params.db_max_connections = 1; /* Set total number of connections to the database */ /* Open a database on the device with given params */ rc = mco_db_open_dev(db_name, convdb_get_dictionary(), dev, 2, &db_params ); if ( MCO_S_OK == rc ) {What to expect as an output
./target/bin/opendb Initialize MCO runtime : Successful Sample 'dbopen' opens a database using conventional memory. eXtremeDB/rt runtime version 1.4, Debug Copyright (c) 2001-2024 McObject LLC. All Rights Reserved. Open database : Successful The opened database has the following characteristics: Evaluation runtime ______ : no Check-level _____________ : 3 Multithread support _____ : yes Fixedrec support ________ : yes Shared memory support ___ : no Statistics support ______ : yes Events support __________ : yes Save/Load support _______ : yes RTree index support _____ : yes Unicode support _________ : yes WChar support ___________ : no Persistent storage support: no Direct pointers mode ____ : no Close database : Successful