Blob Sub-types

From InterBase

Go Up to How are Blob Data Stored?


Although you manage Blob data in the same way as other data types, InterBase provides more flexible datatyping rules for Blob data. Because there are many native data types that you can define as Blob data, InterBase treats them somewhat generically and allows you to define your own data type, known as a subtype. Also, InterBase provides seven standard sub-types with which you can characterize Blob data:

Blob sub-type 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 a current metadata of a table

6

Description of multi-database transaction that finished irregularly

You can specify user-defined sub-types as negative numbers between –1 and
–32,678. Positive integers are reserved for InterBase sub-types.

For example, the following statement defines three Blob columns: Blob1 with sub-type 0 (the default), Blob2 with sub-type 1 (TEXT), and Blob3 with user-defined subt-ype –1:

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

To specify both a default segment length and a sub-type when creating a Blob column, use the SEGMENT SIZE option after the SUB_TYPE option. For example:

EXEC SQL CREATE TABLE TABLE2
(
BLOB1 BLOB SUB_TYPE 1 SEGMENT SIZE 100;
);

The only rule InterBase enforces over these user-defined sub-types is that, when converting a Blob from one sub-type to another, those sub-types must be compatible. InterBase does not otherwise enforce sub-type integrity.

Advance To: