Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hq200306
Posts: 9
Joined: Thu 16 Mar 2006 14:41

Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by hq200306 » Mon 31 Dec 2012 01:50

Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

--Oracle table
create table t1(
id number(9) not null,
graphic blob,
primary key (id)
);


--insert some pictures

//Delphi XE3(32),Oracle Blob
//Test VirtualTable1.SaveToStream VirtualTable1.LoadFromStream
//It not correct

procedure TForm39.SpeedButton1Click(Sender: TObject);
var
stream: TMemoryStream;
filename: string;
begin
stream := TMemoryStream.Create;
try
UniQuery1.Close;
UniQuery1.Open;
VirtualTable1.Assign(UniQuery1);
VirtualTable1.SaveToStream(stream);
VirtualTable1.LoadFromStream(stream);

VirtualTable1.Open;
while not VirtualTable1.Eof do
begin
filename := 'c:\' + VirtualTable1.FieldByName('id').AsString + '.jpg';
TBlobField(VirtualTable1.FieldByName('graphic')).SaveToFile(filename);
VirtualTable1.Next;
end;
VirtualTable1.Close;
finally
stream.Free;
end;
VirtualTable1.Open;
end;

//Test VirtualTable1.SaveToFile VirtualTable1.LoadFromFile
//It not correct

procedure TForm39.SpeedButton2Click(Sender: TObject);
var
filename: string;
begin
UniQuery1.Close;
UniQuery1.Open;
VirtualTable1.Assign(UniQuery1);
VirtualTable1.SaveToFile('c:\1.vtd');
VirtualTable1.LoadFromFile('c:\1.vtd');

VirtualTable1.Open;
while not VirtualTable1.Eof do
begin
filename := 'c:\' + VirtualTable1.FieldByName('id').AsString + '.jpg';
TBlobField(VirtualTable1.FieldByName('graphic')).SaveToFile(filename);
VirtualTable1.Next;
end;
VirtualTable1.Close;
end;

hq200306
Posts: 9
Joined: Thu 16 Mar 2006 14:41

Re: Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by hq200306 » Mon 31 Dec 2012 14:33

if Field <> nil then
case Field.DataType of
ftBlob:
Field.AsBytes := St;
ftString, {ftBlob,} ftMemo:

Field.{$IFDEF VER12P}AsAnsiString{$ELSE}AsString{$ENDIF} := Encoding.Default.GetString(St);

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by AlexP » Wed 02 Jan 2013 12:09

Hello,

We cannot reproduce the issue using either the SaveToStream/LoadFromStream or SaveToFile/LoadFromFile methods. BLOB data (images) are saved correctly with the code you have provided

Code: Select all

TBlobField(VirtualTable1.FieldByName('graphic')).SaveToFile(filename);
Please describe the problem in greater detail: the error occurs when saving, the file is saved incorrectly, etc.

hq200306
Posts: 9
Joined: Thu 16 Mar 2006 14:41

Re: Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by hq200306 » Wed 02 Jan 2013 15:42

The same code in My PC(Unidac 4.6.11,Win32 XP,Delphi XE3_Update1)do not display correctly. But,run in Delphi XE is correctly. I Modify the following code.It can run correctly in both XE/XE3_u1.

procedure TVirtualTable.LoadFromStream(Stream: TStream; LoadFields: boolean);
...
if Field <> nil then
case Field.DataType of
ftBlob: Field.AsBytes := St;
ftString, ftMemo:
Field.{$IFDEF VER12P}AsAnsiString{$ELSE}AsString{$ENDIF} := Encoding.Default.GetString(St);

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by AlexP » Thu 03 Jan 2013 09:50

Hello,

We cannot reproduce the problem with the code you have provided, graphic data are loaded to VT correctly and are saved on drive both with XE and XE3. Please send us a small sample demonstrating the problem (including the table creation script) to alexp*devar*com

hq200306
Posts: 9
Joined: Thu 16 Mar 2006 14:41

Re: Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by hq200306 » Thu 03 Jan 2013 15:24

I have send a email for you. It Contains demo and orale dmp.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by AlexP » Tue 08 Jan 2013 13:44

Hello,

I have received your demo project - all three samples work correctly. Please specify your exact version of XE3 (whether Update 1 is installed or not).

hq200306
Posts: 9
Joined: Thu 16 Mar 2006 14:41

Re: Unidac 4.6.11 VirtualTable can not load oracle blob data in Win32 XE3

Post by hq200306 » Tue 08 Jan 2013 15:29

Thank you!I think that may be the Chinese Windows XP caused.I modify code of VirtualTable, now It can work correctly

Post Reply