UDFs: Interface Code

This section introduces to the interface code function. Includes a description of the steps required to call the function.

The function will have the following signature:

void weightedAverage3(C8Udf *ctx);

You must use accessor functions to unpack the parameters in the call, and then call the actual requested function. The accessor functions are easy to use and reflect the user's parameter typing.

The context structure allows for access to type information input/output values, NULL indicators, and meta-information about the function call. You can choose to ignore meta-information, as this contains only supporting information such as parameter names and types, but you must, extract the parameters from the input parameter list. Depending on the application, you should test each parameter for the NULL status. If a parameter is NULL, the parameter value is undefined.

Sybase CEP passes data by value as in C. Input values should not be modified or freed; they are read-only values. Memory allocated by Sybase CEP must be freed by Sybase CEP. You must free the memory you have allocated.

After your routine finishes, the output value should either contain a value or be set to NULL.