DbiGetBlob

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

DbiGetBlob

Return to chapter overview

C syntax

DBIResult DBIFN DbiGetBlob (hCursor, pRecBuf, iField, iOffSet, iLen, pDest, piRead);

Delphi syntax

function DbiGetBlob (hCursor: hDBICur; pRecBuf: Pointer; iField: Word; iOffSet: Longint; iLen: Longint; pDest: Pointer; var iRead: Longint): DBIResult stdcall;

Description

DbiGetBlob retrieves data from the specified BLOB field.

Parameters

hCursor                Type: hDBICur                (Input)
Specifies the cursor handle.

pRecBuf                Type: pBYTE                (Input)
Pointer to the record buffer containing the BLOB handle. The record buffer is returned from a call to DbiGetNextRecord, DbiGetPriorRecord, DbiGetRelativeRecord, or DbiGetRecord. DbiOpenBlob sets the BLOB handle in the record buffer.

iField                Type: UINT16                (Input)
Specifies the ordinal number of the BLOB field in the record.

iOffSet                Type: UINT32                (Input)
Specifies the start location for retrieval within the BLOB field. If 0 is specified, retrieval starts from the beginning of the field. If the value exceeds the length of the BLOB field, an error is returned. If any value greater than 0 is specified, then only a portion of the BLOB field is retrieved.

iLen                Type: UINT32                (Input)
Specifies the number of bytes to retrieve. iLen must be between 0 and the length of the BLOB field. iLen may be larger than 64K.

pDest                Type: pBYTE                (Output)
Pointer to the client buffer that receives the BLOB data.

piRead                Type: pUINT32                (Output)
Pointer to the client variable that receives the actual number of bytes read. The actual number can be less than the number of bytes requested if the end of the BLOB is reached.

Usage

Any portion of the data within the BLOB field can be retrieved, starting from the position specified in iOffSet, and extending to the number of bytes specified in iLen. pRecBuf should contain a BLOB handle obtained by calling DbiOpenBlob. DbiGetBlob can access data larger than 64Kb, depending on the size you allocate for the buffer.

Prerequisites

The current record buffer must contain a BLOB field which has been opened by a call to DbiOpenBlob.

Completion state

piRead points to the number of bytes of BLOB data retrieved, and pDest points to the retrieved BLOB data.

DbiResult

Meaning

DBIERR_NONE

The BLOB field was successfully retrieved.

DBIERR_BLOBNOTOPENED

The specified BLOB field has not been opened via call to DbiOpenBlob.

DBIERR_INVALIDBLOBHANDLE

The logical BLOB handle supplied in the record buffer is invalid.

DBIERR_NOTABLOB

The specified field number does not correspond to a BLOB field.

DBIERR_INVALIDBLOBOFFSET

The start location specified in iOffSet is greater than the length of the BLOB field.

DBIERR_ENDOFBLOB

The end of the BLOB has been reached. Check piRead to see if any data was returned.

See also

DbiOpenBlob, DbiPutBlob, DbiFreeBlob, DbiTruncateBlob, DbiGetBlobSize