BLOB Subtypes

From InterBase

Go Up to Defining BLOB Data Types


When you define a BLOB column, you have the option of specifying a subtype. A BLOB subtype is a positive or negative integer that describes the nature of the BLOB data contained in the column. InterBase provides two predefined subtypes, 0, signifying that a BLOB contains binary data, the default, and 1, signifying that a BLOB contains ASCII text. User-defined subtypes must always be represented as negative integers. Positive integers are reserved for use by InterBase.

Blob subtypes
Blob subtype Description

0

Unstructured, generally applied to binary data or data of an indeterminate type

1

Text

2

Binary language representation (BLR)

3

Access control list

4

(Reserved for future use)

5

Encoded description of the current metadata of a table

6

Description of multi-database transaction that finished irregularly

Note:
TEXT is a keyword and can be used in a BLOB column declaration instead of the subtype number.

For example, the following statement defines three BLOB columns: BLOB1 with subtype 0 (the default), BLOB2 with InterBase subtype 1 (TEXT), and BLOB3 with user-defined subtype –1:

CREATE TABLE TABLE2
(BLOB1 BLOB,
 BLOB2 BLOB SUB_TYPE 1,
 BLOB3 BLOB SUB_TYPE 1);

The application is responsible for ensuring that data stored in a BLOB column agrees with its subtype. For example, if subtype –10 denotes a certain data type in a particular application, then the application must ensure that only data of that data type is written to a BLOB column of subtype –10. InterBase does not check the type or format of BLOB data.

To specify both a default segment length and a subtype when creating a BLOB column, use the SEGMENT SIZE option after the SUB_TYPE option, as in the following example:

CREATE TABLE TABLE2
(BLOB1 BLOB SUB_TYPE 1 SEGMENT SIZE 100 CHARACTER SET DOS437);

Advance To: