I need to append data to a blob... How do I?
Posted: Tue 12 Sep 2006 10:12
Hi there,
I have data coming in a memory stream with an event each time data is added to it. Actually, it is a fax reception.
I want to store data directly to a blob in my database (9i) and I have odac 5.80 installed.
I thought it should be working with this:
procedure TfrmCAPIConfigDetail.FaxStreamToFaxRecord;
Var intCurrentPos : Integer;
intCopyBytes : Integer;
blobSFF : TOraLob;
pBuffer : PByte;
begin
pBuffer := Nil; blobSFF := Nil;
try
FFaxPages := FProtocol.FaxRecvInfo.Pages;
If Assigned (FFaxRecord) then begin
FFaxRecord.Edit;
blobSFF := FFaxRecord.GetLob('FAX');
intCurrentPos := blobSFF.Size;
intCopyBytes := FFaxStream.Size-intCurrentPos;
pBuffer := FFaxStream.Memory; Inc(pBuffer, intCurrentPos);
blobSFF.Write(intCurrentPos, intCopyBytes, pBuffer);
// FFaxRecord.FieldByName('BLOB_SIZE').AsInteger := blobSFF.Size; <- This line is a test. Commented removed, the correct size of the Blob is saved to the DB!
FFaxRecord.Post;
end else SendMessage ('FAX RECORD CLOSED. UNABLE TO UPDATE');
except
On E: Exception do begin
SendMessage ('FAX TRANSFER DATA ERROR: '+E.Message);
FHandler.DisconnectLine($349B);
if Assigned(FfaxRecord) And (FFaxRecord.State=dsEdit) then FFaxRecord.Post;
end;
end;
end;
but it ain't... My Blob is empty! Do you know what am I doing wrong?
Thanks.
I have data coming in a memory stream with an event each time data is added to it. Actually, it is a fax reception.
I want to store data directly to a blob in my database (9i) and I have odac 5.80 installed.
I thought it should be working with this:
procedure TfrmCAPIConfigDetail.FaxStreamToFaxRecord;
Var intCurrentPos : Integer;
intCopyBytes : Integer;
blobSFF : TOraLob;
pBuffer : PByte;
begin
pBuffer := Nil; blobSFF := Nil;
try
FFaxPages := FProtocol.FaxRecvInfo.Pages;
If Assigned (FFaxRecord) then begin
FFaxRecord.Edit;
blobSFF := FFaxRecord.GetLob('FAX');
intCurrentPos := blobSFF.Size;
intCopyBytes := FFaxStream.Size-intCurrentPos;
pBuffer := FFaxStream.Memory; Inc(pBuffer, intCurrentPos);
blobSFF.Write(intCurrentPos, intCopyBytes, pBuffer);
// FFaxRecord.FieldByName('BLOB_SIZE').AsInteger := blobSFF.Size; <- This line is a test. Commented removed, the correct size of the Blob is saved to the DB!
FFaxRecord.Post;
end else SendMessage ('FAX RECORD CLOSED. UNABLE TO UPDATE');
except
On E: Exception do begin
SendMessage ('FAX TRANSFER DATA ERROR: '+E.Message);
FHandler.DisconnectLine($349B);
if Assigned(FfaxRecord) And (FFaxRecord.State=dsEdit) then FFaxRecord.Post;
end;
end;
end;
but it ain't... My Blob is empty! Do you know what am I doing wrong?
Thanks.