BLOB Segment Length
Go Up to Defining BLOB Data Types
BLOB column is defined in a table, the
BLOB definition can specify the expected size of
BLOB segments that are written to the column. Actually, for
BLOB segments can be of varying length. For example, during insertion, a
BLOB might be read in as three segments, the first segment having length 30, the second having length 300, and the third having length 3.
The length of an individual segment should be specified when it is written. For example, the following code fragment inserts a
BLOB segment. The segment length is specified in the host variable,
INSERT CURSOR BCINS VALUES (:write_segment_buffer :segment_length);
Defining Segment Length
gpre, the InterBase precompiler, is used to process embedded SQL statements inside applications. The segment length setting, defined for a
BLOB column when it is created, is used to determine the size of the internal buffer where the
BLOB segment data will be written. This setting specifies (to
gpre) the maximum number of bytes that an application is expected to write to any segment in the column. The default segment length is 80. Normally, an application should not attempt to write segments larger than the segment length defined in the table; doing so overflows the internal segment buffer, corrupting memory in the process.
The segment length setting does not affect InterBase system performance. Choose the segment length most convenient for the specific application. The largest possible segment length is 32 kilobytes (32,767 bytes).
The following statement creates two BLOB columns, BLOB1, with a default segment size of 80, and BLOB2, with a specified segment length of 512:
CREATE TABLE TABLE2 (BLOB1 BLOB,BLOB2 BLOB SEGMENT SIZE 512);