isc_blob_gen_bpb2()

From InterBase

Go Up to API Function Reference


Generates a Blob parameter buffer (BPB) to allow dynamic access to Blob subtype and character set information.

Syntax

 ISC_STATUS isc_blob_gen_bpb2(
 ISC_STATUS *status_vector,
 ISC_BLOB_DESC_V2 *to_desc,
 ISC_BLOB_DESC_V2 *from_desc,
 unsigned short bpb_buffer_length,
 unsigned char *bpb_buffer,
 unsigned short *bpb_length);
Parameter Type Description

status_vector

ISC_STATUS *

Pointer to the error status vector

to_desc

ISC_BLOB_DESC_V2 *

Pointer to the target Blob descriptor

from_desc

ISC_BLOB_DESC_V2 *

Pointer to the source Blob descriptor

bpb_buffer_length

unsigned short

Length of the BPB bpb_buffer

bpb_buffer

unsigned char *

Pointer to the BPB

bpb_length

unsigned short *

Pointer to the length of the data stored into the BPB

Description

isc_blob_gen_bpb2() generates a Blob parameter buffer (BPB) from subtype and character set information stored in the source Blob descriptor from_desc and the target (destination) Blob descriptor to_desc.

A BPB is needed whenever a filter will be used when writing to or reading from a Blob column. Two Blob descriptors are needed for filtering: one (from_desc) to describe the filter source data, and the other (to_desc) to describe the destination. The descriptors must have been previously created either directly, or via a call to isc_blob_default_desc2(), isc_blob_lookup_desc2(), or ­isc_blob_set_desc2().

The BPB generated by isc_blob_gen_bpb2() is subsequently needed in calls to isc_open_blob2() or isc_create_blob2() if filtering will be utilized. For more information about the BPB, see Working with Blob Data.

Important: In the two ISC_BLOB_DESC_V2 structures passed by to_desc and from_desc, you must set the blob_desc_version fields to BLB_DESC_CURRENT_VERSION. ISC_BLOB_DESC_V2 supports long metadata names of length METADATALENGTH. The older ISC_BLOB_DESC structure supports only metadata names of 32 bytes or less.

Example

The following fragment generates the Blob descriptor:

isc_blob_gen_bpb2(status, &to_desc, &from_desc, bpb_length, &buffer, &buf_length);

Return value

isc_blob_gen_bpb2() returns the second element of the status vector. Zero indicates success. A nonzero value indicates an error. For InterBase errors, the first element of the status vector is set to 1, and the second element is set to an InterBase error code.

To check for an InterBase error, examine the first two elements of the status vector directly.

For more information about examining the status vector, see Handling Error Conditions.

See Also

Advance To: