Register a user-defined function.
MCO_RET mco_db_register_udf( /*IN*/ const char * dbname,
/*IN*/ mco_userdef_funcs_h udfs );
| dbname | The name of the database to open. Taken from the declare database dbname DDL statement. Note that the maximum database name length is 16 characters |
| udfs | An array of user-defined functions. Normally this is obtained by calling the generated function dbname_get_udfs() |
This function registers the array of user-defined functions with the runtime.
| MCO_S_OK | The database was created successfully |
| MCO_E_INSTANCES_LIMIT | No more space in registry |
Application snippet:
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);
...
}
...
}