Page 1 of 1

TUniDump.OnBackupProgress

Posted: Mon 29 Oct 2012 16:45
by Guillaume
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

Re: TUniDump.OnBackupProgress

Posted: Tue 30 Oct 2012 10:11
by AlexP
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%

Re: TUniDump.OnBackupProgress

Posted: Tue 30 Oct 2012 11:50
by Guillaume
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

Re: TUniDump.OnBackupProgress

Posted: Tue 30 Oct 2012 13:07
by AlexP
Hello,

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