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 | A handle to a calculator object that was initialized by a call to mco_calc_init() |
|
ch |
A handle to a new calculator object. Normally, this handle is passed in by calling |
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 the calling
mco_calc_fill_db(). The calculator handle passed incalcmust first be initialized by callingto link the database dictionary. An alternative methodmco_calc_init()mco_calc_register_classes()can be used to explicitly register classes with the calculator.)
| MCO_S_OK | The calculator was successfully initialized |
| MCO_E_NOMEM | Out of memory allocating classes |
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".