Declaring an External Filter to the Database
To declare an external filter to a database, use the DECLARE FILTER
statement. For example, the following statement declares the filter, SAMPLE
:
EXEC SQL DECLARE FILTER SAMPLE INPUT_TYPE -1 OUTPUT_TYPE -2 ENTRY_POINT 'FilterFunction' MODULE_NAME 'filter.dll';
In the example, the input sub-type of the filter is defined as -1 and its output sub-type as -2. In this example, INPUT_TYPE
specifies lowercase text and OUTPUT_TYPE
specifies uppercase text. The purpose of filter, SAMPLE
, therefore, is to translate Blob data from lowercase text to uppercase text.
The ENTRY_POINT
and MODULE_NAME
parameters specify the external routine that InterBase calls when the filter is invoked. The MODULE_NAME
parameter specifies filter.dll, the dynamic link library containing the executable code of the filter. The ENTRY_POINT
parameter specifies the entry point into the DLL. The example shows only a simple file name. It is good practice to specify a fully-qualified path name, since users of your application need to load the file.