FirebirdSQL logo

Specifying the Subtypes

The subtypes can be specified as the subtype number or as the subtype mnemonic name.Custom subtypes must be represented by negative numbers (from -1 to -32,768), or their user-defined name from the RDB$TYPES table.An attempt to declare more than one BLOB filter with the same combination of the input and output types will fail with an error.

INPUT_TYPE

clause defining the BLOB subtype of the object to be converted

OUTPUT_TYPE

clause defining the BLOB subtype of the object to be created.

Note

Mnemonic names can be defined for custom BLOB subtypes and inserted manually into the system table RDB$TYPES system table:

INSERT INTO RDB$TYPES (RDB$FIELD_NAME, RDB$TYPE, RDB$TYPE_NAME)
VALUES ('RDB$FIELD_SUB_TYPE', -33, 'MIDI');

After the transaction is committed, the mnemonic names can be used in declarations when you create new filters.

The value of the column RDB$FIELD_NAME must always be 'RDB$FIELD_SUB_TYPE'.If a mnemonic names was defined in upper case, they can be used case-insensitively and without quotation marks when a filter is declared, following the rules for other object names.

Warning

In general, the system tables are not writable by users.However, inserting custom types into RDB$TYPES is still possible if the user is an administrator, or has the system privilege CREATE_USER_TYPES.

Parameters

ENTRY_POINT

clause defining the name of the entry point (the name of the imported function) in the module.

MODULE_NAME

The clause defining the name of the module where the exported function is located.By default, modules must be located in the UDF folder of the root directory on the server.The UDFAccess parameter in firebird.conf allows editing of access restrictions to filter libraries.

Any user connected to the database can declare a BLOB filter.

docnext count = 5

Who Can Create a BLOB Filter?

The DECLARE FILTER statement can be executed by:

The user executing the DECLARE FILTER statement becomes the owner of the filter.

Examples of DECLARE FILTER

  1. Creating a BLOB filter using subtype numbers.

    DECLARE FILTER DESC_FILTER
      INPUT_TYPE 1
      OUTPUT_TYPE -4
      ENTRY_POINT 'desc_filter'
      MODULE_NAME 'FILTERLIB';
  2. Creating a BLOB filter using subtype mnemonic names.

    DECLARE FILTER FUNNEL
      INPUT_TYPE blr OUTPUT_TYPE text
      ENTRY_POINT 'blr2asc' MODULE_NAME 'myfilterlib';

DROP FILTER

Drops a BLOB filter declaration from the current database

Available in

DSQL, ESQL

Syntax
DROP FILTER filtername
Table 1. DROP FILTER Statement Parameter
Parameter Description

filtername

Filter name in the database

The DROP FILTER statement removes the declaration of a BLOB filter from the database.Removing a BLOB filter from a database makes it unavailable for use from that database.The dynamic library where the conversion function is located remains intact and the removal from one database does not affect other databases in which the same BLOB filter is still declared.

Who Can Drop a BLOB Filter?

The DROP FILTER statement can be executed by:

  • Administrators

  • The owner of the filter

  • Users with the DROP ANY FILTER privilege

DROP FILTER Example

Dropping a BLOB filter.
DROP FILTER DESC_FILTER;