Setting function pointers for the user-mapping plug-in (C programming language)
Pass the pointers to the required functions to the federated server, and obtain the pointers to the utility functions from the federated server.
/* The plug-in initialization function. Do not change the name. */
SQL_API_RC SQL_API_FN FSUMPluginInit
(sqlint32 a_version,
FSUMPluginAPIs* a_pluginAPIs,
FSUMPluginUtilities* a_pluginUtils)
{
SQL_API_RC rc = FSUM_PLUGIN_OK ;
/* Pass the function pointers to federated server */
a_pluginAPIs->FSUMconnect = &myConnect
a_pluginAPIs->FSUMfetchUM = &myFetchUM
a_pluginAPIs->FSUMdisconnect = &myDisconnect
a_pluginAPIs->FSUMPluginTerm = &myPluginTerm
/* Get the pointers of the required utility functions */
FSUMallocate = a_pluginUtils->allocate;
FSUMdeallocate = a_pluginUtils->deallocate;
FSUMlogErrorMsg = a_pluginUtils->logErrorMsg;
FSUMaddUMOption = a_pluginUtils->addUMOption;
/*You can also get the pointers of the optional utility functions */
/** If there is an error, do the following:
1. Optional --- Call FSUMlogErrorMsg to log the error
2. Mandatory --- Return error code rc = FSUM_INITIALIZE_ERROR
**/
return rc;
}