BlobEdit

Description

Inserts data of any PocketBuilder datatype into a blob variable.

Syntax

BlobEdit ( blobvariable, n, data )

Argument

Description

blobvariable

An initialized variable of the blob datatype into which you want to copy a standard PocketBuilder datatype

n

The number (1 to 4,294,967,295) of the position in blobvariable at which you want to begin copying the data

data

Data of a valid PocketBuilder datatype that you want to copy into blobvariable

Returns

Unsigned long. Returns the position at which the next data can be copied if it succeeds, and returns null if there is not enough space in blobvariable to copy the data. If any argument’s value is null, BlobEdit returns null.

If the data argument is a string, the position in the blobvariable in which you want to copy data will be the length of the string + 2. If the data argument is a string converted to a blob, the position will be the length of the string + 1. This is because a string contains a null terminating character that it loses when it is converted to a blob. Thus, BlobEdit (blob_var, 1, "ZZZ'') returns 5, while BlobEdit (blob_var, 1, blob (''ZZZ'') ) returns 4.

Examples

Example 1

This example copies a bitmap in the blob emp_photo starting at position 1, stores the position at which the next copy can begin in nbr, and then copies a date into the blob emp_photo after the bitmap data:

blob{1000} emp_photo

blob temp

date pic_date

ulong nbr


... // Read BMP file containing employee picture

... // into temp using FileOpen and FileRead.

pic_date = Today()


nbr = BlobEdit(emp_photo, 1, temp)

BlobEdit(emp_photo, nbr, pic_date)

UPDATEBLOB Employee SET pic = :emp_photo

    WHERE ...

See also