Re-Posting, Problem with Query Blob and TStream
From: David (ddenby_at_pernet.net)
Date: 11/24/04
- Previous message: David Fallas: "Re: ADOCommand and grave accent problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 24 Nov 2004 10:33:41 -0700
I'm re-posting this due to a lack of response to the earlier posting. BTW: I have already tried TadoBlobStream without success. This seems to be timing related. Also, is there a way to directly parse (Byte by Byte) the data contained in a Blob field within a Query result set? (instead of using a stream object)
Original post follows:
---------------------------------------------------------
This message was posted in the "language" newsgroup but may also apply
to the ADO section...
I am having a frustrating problem using TStream to receive data from a
database Blob field (in a table residing in an Oracle 8i database) and
then reading the resulting data:
I assign the var as "Raw: TStream;" in the procedure declarations then
populate it with the following:
----------------------
Raw :=
DM2.Qry_ChanData.CreateBlobStream(DM2.Qry_ChanData.FieldByName('Valuecodes')
,bmRead);
(Where: DM2 is a data module and Qry_ChanData is an ADO Query using an
ADO Connection)
Then I parse the stream using a read like this:
for I = 1 to 50 do begin
Raw.Read(Dx,SizeOf(Dx));
MyArray[I-1] := Dx;
end;
Raw.Read(Junk,4); // skip separator bytes
for I = 1 to 50 do begin
Raw.Read(MyChr,1);
MyArray2[I-1] := MyChr;
end;
---------------------------
On exit from the Procedure, I free the TStream (but I have also tried
removing the "Raw.Free;" statement and get similar results)
The problem I am having is that periodically I get "Garbage" when I evaluate
the value the Dx variable. It usually starts happening at approximately the
same offset into the stream but it only occurs sporadically (about every
third record). I suspect it may be a timing issue but inserting
"Application.ProcessMessages" doesn't seem to help.
I have also tried Raw.ReadBuffer(Dx,SizeOf(Dx)), etc. which DOES throw
an exception when the stream is read for some records but it doesn't
help in identifying what the true problem is with returning a complete
and un-corrupted set of values from the Blob field in the database. The
data in the record's Blob itself is intact because other applications
are able to successfully read the Blob data.
I am using D7 with the latest available patches and very few third party
components (none that are used in this app).
Another interesting observation is that the garbage occurs for the last
20 or so values of Dx in one record (the related MyChr seems OK) and
then the first 20 or so values of the MyChr values of the next record
(where the corresponding value of Dx seems to be OK). Then everything
seems to realign properly again for two to three records then I get the
garbage again.
Has anyone had a similar experience and is there a solution to a problem
like this?
TIA
- Previous message: David Fallas: "Re: ADOCommand and grave accent problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|