Every FairCom DB API callback function must be a function that returns CTDBRET and takes a CTHANDLE parameter. The following typedef declares the function callback type:
typedef CTDBRET (ctdbDECL* ctdbCallbackFunc)(CTHANDLE Handle);
When implementing callbacks you need to create your callback functions with the same type of ctdbCallbackFunc. Below is an example of a FairCom DB API session logon callback.
FairCom DB API C API Example
CTDBRET ctdbDECL OnSessionLogon(CTHANDLE Handle)
{
pCTDBSESSION pSession = (pCTDBSESSION)Handle;
printf("Server: %s\n", pSession->server_name);
printf("User: %s\n", pSession->user_name);
printf("Password: %s\n", pSession->user_password);
}
Please refer to the Callback Types section below for more information on each available callback type.