Browse through the calculator indexes.
MCO_RET mco_calc_iinfo_browse( /*IN*/ mco_calc_t * calc,
/*IN*/ mco_calc_iinfo_h handler,
/*IN*/ void * data);
| calc | A handle to the initialized calculator object |
|
handler |
A user supplied handler function to process the class information |
|
data |
A pointer to user supplied data |
This function browses through calculator indexes, one index at time, and calls the user supplied handler function to process (print or perform some calculation with) the index information. Additional application-specific data may be passed into the handler function via parameter
data.
| MCO_S_OK | The class statistics were collected successfully |
|
MCO_E_TRANSACT |
A transaction was in an error state during calculator processing |
Application snippet: const char * dbname = "calc_db"; static void index_print(mco_calc_t *calc, mco_cc_t *cls, mco_index_stat_t *istat, void *unused) { int tmp, psize = 0; char *str = NULL, c; if ((istat->type & MCO_IDXST_TYPE_MASK) == MCO_IDXST_TYPE_MEM) { str = "Inmem"; psize = calc->pg_size; } else if ((istat->type & MCO_IDXST_TYPE_MASK) == MCO_IDXST_TYPE_DISK) { str = "Disk"; psize = _disk_page_size; } printf(" -> %s [%s ", istat->plabel, str); ... } int main(int argc, char* argv[]) { MCO_RET rc; mco_device_t dev; mco_calc_t calc; mco_db_params_t db_params; mco_cc_info_t info; 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()); ... rc = mco_calc_fill_db(&calc); ... rc = mco_calc_stat_collect(&calc); ... printf("\Index info:\n"); rc = mco_calc_iinfo_browse(&calc, index_print, (void*)0); ... /* 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".