Subject | Reading large blobs |
---|---|
Author | Don Schoeman |
Post date | 2005-09-21T12:59:36Z |
Hi,
I'm trying to read a blob stream directly into an array of integers using
something like this:
procedure GetDataFromBlob(ASource: TIB_Column; var ADestination:
TIntegerArray; ALength: Integer);
var
vBufferPtr: Pointer;
begin
vBufferPtr := @ADestination[0];
with (ASource as TIB_ColumnBinary).Statement.CreateBlobStream(ASource,
bsmRead) do
begin
try
ReadBuffer(vBufferPtr^, ALength * SizeOf(Integer));
finally
Free;
end;
end;
end;
I call this routine like this:
SetLength(vTempArray, 10);
GetDataFromBlob(IB_MyQuery.FieldByName('SOME_FIELD'), vTempArray, 10);
The problem is that the blob's size property says that it's 0 in size and I
get a blob read error. I'm trying to figure out if the problem is where I
insert data into the blob or when I try and read it. If this is not the
correct method of reading the blob, I'll use another method I know works and
that is to create a tempory stream and then put the data into the stream,
and then write it to an array. In this case it's not efficient enough
though, so I'd like to write it directly into the array.
Thx in advance,
Don
I'm trying to read a blob stream directly into an array of integers using
something like this:
procedure GetDataFromBlob(ASource: TIB_Column; var ADestination:
TIntegerArray; ALength: Integer);
var
vBufferPtr: Pointer;
begin
vBufferPtr := @ADestination[0];
with (ASource as TIB_ColumnBinary).Statement.CreateBlobStream(ASource,
bsmRead) do
begin
try
ReadBuffer(vBufferPtr^, ALength * SizeOf(Integer));
finally
Free;
end;
end;
end;
I call this routine like this:
SetLength(vTempArray, 10);
GetDataFromBlob(IB_MyQuery.FieldByName('SOME_FIELD'), vTempArray, 10);
The problem is that the blob's size property says that it's 0 in size and I
get a blob read error. I'm trying to figure out if the problem is where I
insert data into the blob or when I try and read it. If this is not the
correct method of reading the blob, I'll use another method I know works and
that is to create a tempory stream and then put the data into the stream,
and then write it to an array. In this case it's not efficient enough
though, so I'd like to write it directly into the array.
Thx in advance,
Don