sx_GetBlob

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_GetBlob

VB Declaration

Declare Function sx_GetBlob Lib "Apollo9.dll"

(ByVal cpFieldName As String

vpVar As Any)

As Long

C Declaration

LONG FAR PASCAL sx_GetBlob

(BYTEP cpFieldName,

VOIDP vpVar);

Description

Retrieves a BLOB that was stored in a memo field. A BLOB is a binary large object. The maximum size of a BLOB is 16 megabytes.

Elements that contain fixed length strings may be stored and retrieved.

BLOBS are stored in memo fields either with sx_PutBlob or sx_Replace.

Parameters

cpFieldName: The name of the memo field that holds the BLOB.

vpVar: A pointer to a pre-initialized memory object of the correct size. Use sx_GetBlobLength to determine that size.

Return Value

The size of the BLOB as a long integer. If this differs from the size returned by sx_GetBlobLength, an error has occurred.

VB Example

' save and retrieve an array of integers to and from a BLOB

Static intArray(20) As Integer

Dim i As Integer

Dim lSize As Long

Dim lBytes As Long

Dim DynArray() As Integer

 

' set up blob example

For i = 1 To 20

intArray(i - 1) = i + 99

Next i

 

' write array to disk

lSize = UBound(intArray) - LBound(intArray) + 1

lSize = lSize * Len(intArray(LBound(intArray)))

lBytes = sx_PutBlob("notes", intArray(LBound(intArray)), lSize)

If lBytes <> lSize Then

MsgBox "Blob write error"

Exit Sub

End If

sx_Commit

 

' retrieve array from same record

lSize = sx_GetBlobLength("notes")

ReDim DynArray(lSize / 2)

lBytes = sx_GetBlob("notes", DynArray(LBound(DynArray)))

 

If lBytes <> lSize Then

MsgBox "Blob read error"

Exit Sub

Else

For i = 1 To 20

Debug.Print DynArray(i - 1)

Next i

End If

C Example

VOIDP vpVar;

vpVar = (VOIDP) sx_MemAlloc(sx_GetBlobLength("blobfield"));

if ((sx_GetBlob("blobfield", vpVar) != sx_GetBlobLength("blobfield"))

{

sx_MemDealloc(vpVar);

return(FAILURE);

}

See Also

sx_GetBlobLength, sx_PutBlob, sx_Replace