Register the classes enumerated in the database schema.
MCO_RET mco_calc_reg_schema_classes(/*IN*/ mco_calc_t * calc,
/*IN*/ mco_calculator_h ch);
calc
mco_calc_init().ch
dbname_getCalculator().This function registers the classes enumerated in the database schema (and dictionary). It initializes the calculator with the dictionary's built-in information about number of objects of each database class are required. This information is stored separately from the database dictionary, so it needs to be made known to the calculator before calling
mco_calc_fill_db(). The calculator handle passed incalcmust first be initialized by callingmco_calc_init()to link the database dictionary. An alternative methodmco_calc_register_classes()can be used to explicitly register classes with the calculator.
MCO_S_OK
MCO_E_NOMEM
Application snippet: const char * dbname = "calc_db"; int main(int argc, char* argv[]) { MCO_RET rc; mco_device_t dev; mco_calc_t calc; mco_db_params_t db_params; mco_runtime_start(); ... mco_calc_init(&calc, calc_db_get_dictionary()); ... rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params ); if ( MCO_S_OK != rc ) { rc = mco_db_connect( dbname, &calc.db ); ... rc = mco_calc_reg_schema_classes(&calc, calc_db_get_calculator()); } /* NOTE: calculator *must* be deinitialized before you disconnect from the database */ mco_calc_deinit(&calc); mco_db_disconnect(calc.db); }
For further implementation details see SDK sample "samples/native/core/17-statistics/dbcalc".