dbname_get_calculator

This function returns a handle for a database calculator object.

Prototype

 
    mco_calculator_h	databasename_get_calculator(	void );
 

Arguments

No arguments.

Description

This function returns a handle for the calculator object if defined in the database schema; otherwise, returns a null pointer. The calculator object is used to fill the database with test objects and provide statistics on memory usage.

Return Codes

None.

Example

 
    Application snippet:
        
     
    const char * db_name = "calc_db";

 
    int main(int argc, char* argv[])
     {
        MCO_RET rc;
        mco_calc_t calc;
        struct calc_options opts;
        sample_memory_t dbmem;
        sample_os_initialize(DEFAULT);
        memset(&opts, 0, sizeof(opts));
        appname = argv[0];
         
        if (calc_getopt(argc, argv, &opts) < 0) {
            usage();
        }
        recognize_options(&opts);
        mco_error_set_handler(&error_handler);
        rc = mco_runtime_start();
         
        mco_calc_init(&calc, calc_db_get_dictionary());
         
        ...
         
        printf("== MCO eXtremeDB calculation tool ==\n");
        printf("type \"%s -help\" to get more configuration information\n\n", appname);
 
        /* Create the database  */
        rc = sample_open_database( opts.db_name, calc_db_get_dictionary(), DATABASE_SIZE, CACHE_SIZE,
        MEMORY_PAGE_SIZE, PSTORAGE_PAGE_SIZE, 5, &dbmem );
        if (rc) 
        {
            printf("\nerror %d creating database", rc);
            sample_os_shutdown();
            dbg_exit(1);
        }
        rc = mco_calc_reg_schema_classes(&calc, calc_db_get_calculator());
    }