Page 1 of 1

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

Posted: Mon 31 Dec 2012 01:50
by hq200306
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;

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

Posted: Mon 31 Dec 2012 14:33
by hq200306
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);

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

Posted: Wed 02 Jan 2013 12:09
by AlexP
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.

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

Posted: Wed 02 Jan 2013 15:42
by hq200306
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);

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

Posted: Thu 03 Jan 2013 09:50
by AlexP
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

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

Posted: Thu 03 Jan 2013 15:24
by hq200306
I have send a email for you. It Contains demo and orale dmp.

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

Posted: Tue 08 Jan 2013 13:44
by AlexP
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).

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

Posted: Tue 08 Jan 2013 15:29
by hq200306
Thank you!I think that may be the Chinese Windows XP caused.I modify code of VirtualTable, now It can work correctly