Open the SQL engine with McoSqlOpenParameters.
For an overview see page McoSqlEngine
Prototype
void open(McoSqlOpenParameters const ¶ms);Arguments
params An initialized McoSqlOpenParameters instance specifying memory device(s) page size and other database open parameters Description
This method opens an eXtremeDB database, an eXtremeDB SQL mapper and the McoSqlEngine instance with the parameters specified in the McoSqlOpenParameters argument
params
.Returns
This method throws a RuntimeException in the case of an error.
Example
const char * dbname = "RaidDb"; const int n_devices = 5; int main(int argc, char* argv[]) { MCO_RET rc; mco_device_t dev[n_devices]; McoSqlEngine engine; McoSqlOpenParameters params; ... dev[0].type = MCO_MEMORY_CONV; dev[0].assignment = MCO_MEMORY_ASSIGN_DATABASE; dev[0].size = DATABASE_SIZE; dev[0].dev.conv.ptr = (void*)malloc( DATABASE_SIZE ); dev[1].type = MCO_MEMORY_CONV; dev[1].assignment = MCO_MEMORY_ASSIGN_CACHE; dev[1].size = CACHE_SIZE; dev[1].dev.conv.ptr = (void*)malloc( CACHE_SIZE ); dev[2].type = MCO_MEMORY_RAID; dev[2].assignment = MCO_MEMORY_ASSIGN_PERSISTENT; strcpy(dev[2].dev.raid.name, "raidpart.1"); dev[2].dev.raid.flags = MCO_FILE_OPEN_DEFAULT; dev[2].dev.raid.level = 1; dev[3].type = MCO_MEMORY_RAID; dev[3].assignment = MCO_MEMORY_ASSIGN_PERSISTENT; strcpy(dev[3].dev.raid.name, "raidpart.2"); dev[3].dev.raid.flags = MCO_FILE_OPEN_DEFAULT; dev[3].dev.raid.level = 1; dev[4].type = MCO_MEMORY_FILE; dev[4].assignment = MCO_MEMORY_ASSIGN_LOG; strcpy(dev[4].dev.file.name, "persondb.log"); dev[4].dev.file.flags = MCO_FILE_OPEN_DEFAULT; params.databaseName = (char *)db_name; params.dictionary = persondb_get_dictionary(); params.mainMemoryDatabaseSize = DATABASE_SIZE; params.mainMemoryPageSize = MEMORY_PAGE_SIZE; params.n_devices = n_devices; params.devices = dev; engine.open(params); ... }