An introduction to server API signatures, their purposes, and parameters.
These adapter API signatures are defined in c8server.h.
Parameters:
i_section: Specifies a particular section of the configuration file, which is an XML file.
i_preference: Specifies the name of a particular parameter in that section.
i_value: A default that you would like to have returned if the section and preference that you specified are not set in the configuration file.
Returns: The value stored in the specified preference and section.
For example, suppose that we want to find the base folder for input and output files used by the adapters supplied by Sybase CEP. The XML for this part of the server configuration file looks like:
... <section name="Sybase C8/Adapters "> ... <section name=" ReadWriteBaseFolder "> <preference name=" BaseFolder " value="/c8test/D5"/> </section> </section>
The value of the section is
"SybaseC8/Adapters/ReadWriteBaseFolder"
And the value of the preference is
"BaseFolder"
Because one section was nested within another, we composed a single name that included the entire XML path.
Sample C code is below:
C8Char i_section[] = "SybaseC8/Adapters/ReadWriteBaseFolder"; C8Char i_preference[] = "BaseFolder"; C8Char i_default[] = ""; // Default to empty string. C8CharPtr preferenceValue = NULL; preferenceValue = C8ServerGetPreference(i_section, i_preference, i_default); if (preferenceValue != NULL) { ... C8Free(preferenceValue); }
Note: The value returned by this function is stored in memory allocated by the server. To avoid a memory leak, you must free this memory using the C8Free() function.