Register a user-defined function.
MCO_RET mco_db_register_udf(/*IN*/ const char *dbname,
/*IN*/ mco_userdef_funcs_h udfs);
dbname
declare database dbname DDL statement.
Note that the maximum database name length is 16 characters.udfs
dbname_get_udfs().This function registers the array of user-defined functions with the runtime.
MCO_S_OK
MCO_E_INSTANCES_LIMIT
const char *dbname = "SimpleDb";
int main(int argc, char* argv[])
{
mco_db_h db;
MCO_RET rc;
char *mem = malloc(DBSIZE);
if ((rc = mco_runtime_start()) != MCO_S_OK)
exit(-1);
rc = mco_db_open(dbname, simpledb_get_dictionary(), mem, DBSIZE, (uint2)PAGESIZE);
if (MCO_S_OK == rc)
{
/* register custom compare & hash functions on database name */
mco_db_register_udf(dbname, simpledb_get_udfs());
/* connect to database */
rc = mco_db_connect(dbname, &db);
...
}
...
}