[fpc-pascal] Patch/Test BlobSegmentSize was: IBConnection blobsegmentsize irrelevant & performance

Reinier Olislagers reinierolislagers at gmail.com
Sun Nov 20 10:31:49 CET 2011


On 19-11-2011 23:36, Michael Van Canneyt wrote:
> On Sat, 19 Nov 2011, Reinier Olislagers wrote:
>> On 19-11-2011 13:28, Reinier Olislagers wrote: I wonder
>> whether/what changes are required for reading blobs...
> 
> The following function needs adapting:
> 
> function TIBConnection.getMaxBlobSize(blobHandle : TIsc_Blob_Handle)
> : longInt; var iscInfoBlobMaxSegment : byte =
> isc_info_blob_max_segment; blobInfo : array[0..50] of byte;
> 
> begin if isc_blob_info(@Fstatus[0], @blobHandle, 
> sizeof(iscInfoBlobMaxSegment), pchar(@iscInfoBlobMaxSegment), 
> sizeof(blobInfo) CheckError('isc_blob_info', FStatus); if blobInfo[0]
> = isc_info_blob_max_segment then begin result :=
> isc_vax_integer(pchar(@blobInfo[3]), 
> isc_vax_integer(pchar(@blobInfo[1]), 2)); end else 
> CheckError('isc_blob_info', FStatus); end;
> 
> You should first check what it returns. I suspect the declared blob 
> segment size.
> 
> Michael.
getMaxBlobSize does indeed return the segment size used when writing
(i.e. 80 by default on pre 2.7.1, 65535 with my patch).

Changed ibconnection.pp:
- remove getMaxBlobSize function
- use MAXBLOBSEGMENTSIZE (65535) when reading

Tested it with existing blobs written in 80 byte and 65535 byte
segments. Works; the returned value matches what was written in the
first place:
  while FQuery.EOF=false do
  begin
    if FQuery.FieldByName('BLOBCOL').AsString <> RecordText then writeln
('Error reading record');;
    FQuery.Next;
  end;

Patch attached; it applies against 2.7.1.
Please let me know if you want me to open a bug for this...

Thanks,
Reinier
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ibconnection.pp.2.7.1.readblob.diff
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20111120/709621e1/attachment.ksh>


More information about the fpc-pascal mailing list