TUniDump.OnBackupProgress

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Guillaume
Posts: 5
Joined: Fri 21 Sep 2012 07:34

TUniDump.OnBackupProgress

Post by Guillaume » Mon 29 Oct 2012 16:45

Hi,
I have a strange behaviour with the OnBackupProgress event.
With the Oracle provider, I drop on a form a TUniConnection, a TUniDump, a TLabel and a TButton. On the button click, I call the BackupToFile method. And I try to display the percentage of completion :

Code: Select all

procedure TForm5.Button1Click(Sender: TObject);
begin
  UniConnection1.Connected := True;
  UniDump1.OnBackupProgress := ProgressEvent;
  UniDump1.BackupToFile('D:\Temp\Test.txt');
end;

procedure TForm5.ProgressEvent(Sender: TObject; ObjectName: String; ObjectNum: Integer; ObjectCount: Integer; Percent: Integer);
begin
  Label1.Caption := IntToStr(Percent) + '%';
  Application.ProcessMessages;
end;
What happens at runtime ? I see the percentage going from 4% to 100%, then it goes back to 52%, and up to 100% again, then returns to 64%, etc. At the end, it blinks a hundred times between 99% and 100%. Then the file is generated successfully.
Maybe this event is not intended to display the percentage of completion for a final user. Or maybe you will not be able to reproduce if it depends on my data. But I was able to reproduce on 2 different Oracle schemas.
What is your feeling ?
Thanks
Guillaume

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

Re: TUniDump.OnBackupProgress

Post by AlexP » Tue 30 Oct 2012 10:11

hello,

This is correct behaviour of the OnBackupProgress event, this event reflects the percentage of saving data from each table.
If you add the ObjectName parameter output to the event

Code: Select all

Memo1.Lines.Add(IntToStr(Percent) + '% - ' + ObjectName);
it will be clearly seen that percentage is displayed for each table, depending on the number of fields:

Code: Select all

TABLE1 - 20%
TABLE1 - 50%
TABLE1 - 100%
TABLE2 - 15%
TABLE2 - 35%
TABLE2 - 65%
TABLE2 - 100%

Guillaume
Posts: 5
Joined: Fri 21 Sep 2012 07:34

Re: TUniDump.OnBackupProgress

Post by Guillaume » Tue 30 Oct 2012 11:50

I forget to tell I am exporting a single table !
I have replaced the TLabel by a TMemo as suggested in your post, and changed the event according to your answer. Here is the result :

Code: Select all

4% - HUGOINSTRUMENT
8% - HUGOINSTRUMENT
12% - HUGOINSTRUMENT
...
92% - HUGOINSTRUMENT
96% - HUGOINSTRUMENT
100% - HUGOINSTRUMENT
52% - HUGOINSTRUMENT
54% - HUGOINSTRUMENT
...
98% - HUGOINSTRUMENT
100% - HUGOINSTRUMENT
68% - HUGOINSTRUMENT
69% - HUGOINSTRUMENT
...
98% - HUGOINSTRUMENT
100% - HUGOINSTRUMENT
76% - HUGOINSTRUMENT
...
99% - HUGOINSTRUMENT
100% - HUGOINSTRUMENT
...
99% - HUGOINSTRUMENT
100% - HUGOINSTRUMENT
99% - HUGOINSTRUMENT
...
99% - HUGOINSTRUMENT
100% - HUGOINSTRUMENT
My table has more than 22000 rows. And I can see now that the TMemo has exactly the same number of lines : the event is called once for each row !
The values of the parameters ObjectName, ObjectNum and ObjectCount never change ('HUGOINSTRUMENT', 1, 1).

UniDAC version is 4.5.9
Delphi XE2 on W7 x64
Oracle 11g

Thanks for your help

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

Re: TUniDump.OnBackupProgress

Post by AlexP » Tue 30 Oct 2012 13:07

Hello,

Thank you for the information.
We have reproduced the problem.
We will try to fix it in the nearest product version.

Post Reply