Declaring Blob Filters
Go Up to Working with UDFs and Blob Filters
You can use BLOB filters to convert data from one BLOB subtype to another. You can access BLOB filters from any program that contains SQL statements.
BLOB filters are user-written utility programs that convert data in BLOB columns from one subtype to another. The subtype can be either an InterBase subtype or a user-defined one. Declare the filter to the database with the DECLARE FILTER statement. For example:
DECLARE FILTER BLOB_FORMAT
INPUT_TYPE 1 OUTPUT_TYPE -99
ENTRY_POINT 'Text_filter' MODULE_NAME 'Filter_99';
InterBase invokes BLOB filters in either of the following ways:
- SQL statements in an application
- interactively through
isql.
isql automatically uses a built-in ASCII BLOB filter for a BLOB defined without a subtype, when asked to display the BLOB. It also automatically filters BLOB data defined with subtypes to text, if the appropriate filters have been defined.
To use BLOB filters, follow these steps:
- Write the filters and compile them into object code.
- Create a shared filter library.
- Make the filter library available to InterBase at run time.
- Define the filters to the database using
DECLARE FILTER. - Write an application that requests filtering.
You can use BLOB subtypes and BLOB filters to do a large variety of processing. For example, you can define one BLOB subtype to hold:
- Compressed data and another to hold decompressed data. Then you can write
BLOBfilters for expanding and compressingBLOBdata. - Generic code and other
BLOBsubtypes to hold system-specific code. Then you can writeBLOBfilters that add the necessary system-specific variations to the generic code. - Word processor input and another to hold word processor output. Then you can write a
BLOBfilter that invokes the word processor.
For more information about creating and using BLOB filters, see the Embedded SQL Guide. For the complete syntax of DECLARE FILTER, see the Language Reference Guide.