Subject Re: [firebird-support] UDF receiving and returning BLOB (pascal)
Author Vlad Khorsun
> Hi all,
>
> I=B4m writing an UDF to receive any BLOB and return it as another BLOB,
> converted to hexadecimal
>
> Ex: select ps_blob_to_hex(cast('ABC' as blob sub_type 0)) returns a
> blob containing '414243'
>
> I used some pieces of code from FreeUDFLib, and almost everything is
> working, except for the problem below:
>
> // I=B4m using these data structures to represent a Firebird BLOB
>
> TISC_BlobGetSegment =3D function(BlobHandle: PInt; Buffer: PChar;
> BufferSize: Long; var ResultLength: Long): Short; cdecl;

BufferSize must be Short

> TISC_BlobPutSegment =3D procedure(BlobHandle: PInt; Buffer: PChar;
> BufferLength: Short); cdecl;
>
> TBlob =3D record
> GetSegment: TISC_BlobGetSegment;
> BlobHandle: PInt;
> SegmentCount: Long;
> MaxSegmentLength: Long;
> TotalSize: Long;
> PutSegment: TISC_BlobPutSegment;
> end;
>
...
> If i select from the second table, where the size of the blobs are
> larger, it works just on the some records (i presume the records wich
> blob size are below <=3D 32K).

You must PutSegments by pieces less then 32K

Regards,
Vlad