BLOB Subtypes
The optional SUB_TYPE parameter specifies the nature of data written to the column.Firebird provides two pre-defined subtypes for storing user data:
- Subtype 0:
BINARY -
If a subtype is not specified, the specification is assumed to be for untyped data and the default
SUB_TYPE BINARY(orSUB_TYPE 0) is applied.This is the subtype to specify when the data are any form of binary file or stream: images, audio, word-processor files, PDFs and so on. - Subtype 1:
TEXT -
Subtype 1 has an alias,
TEXT, which can be used in declarations and definitions.For instance,BLOB SUB_TYPE TEXT(orBLOB SUB_TYPE 1).It is a specialized subtype used to store plain text data that is too large to fit into a string type.ACHARACTER SETmay be specified, if the field is to store text with a different encoding to that specified for the database.ACOLLATEclause is also supported.Specifying
CHARACTER SETwithout specifying aSUB_TYPEimpliesSUB_TYPE TEXT.
It is also possible to add custom data subtypes, for which the range of enumeration from -1 to -32,768 is reserved.Custom subtypes enumerated with positive numbers are not allowed, as the Firebird engine uses the numbers from 2-upward for some internal subtypes in metadata.Custom subtype aliases can be inserted into the RDB$TYPES table by users with the system privilege CREATE_USER_TYPES.