get calculator
此函数会返回数据库模式中定义的计算器对象的句柄,否则,返回空指针。
计算器对象用于向数据库填充测试对象,并提供有关内存使用情况的统计信息。
mco_calculator_h databasename_get_calculator(void);
参数
没有参数。
返回
没有返回码。
示例
/* 应用程序代码片段 */
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 SmartEDB 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());
}