Progress event when fetchning data
Progress event when fetchning data
Hello,
is it possible to add event for progress when fetchnig data from db server to TUniQuery (etc.).
When fetching large amount of data, App.ProcessMessages to refresh app should be usefull.
Thanks
Zdenek
is it possible to add event for progress when fetchnig data from db server to TUniQuery (etc.).
When fetching large amount of data, App.ProcessMessages to refresh app should be usefull.
Thanks
Zdenek
Hello,
For displaying the process of fetching data from the server you can use the AfterFetch event.
For this you should set the FetchAll option to false and set necessary value in the FetchRows property, for example:
For displaying the process of fetching data from the server you can use the AfterFetch event.
For this you should set the FetchAll option to false and set necessary value in the FetchRows property, for example:
Code: Select all
var
FCounter: integer;
procedure TForm1.UniQuery1AfterFetch(DataSet: TCustomDADataSet);
begin
if UniQuery1.RecordCount > 0 then
ProgressBar1.Position := Round(100*FCounter/UniQuery1.RecordCount);
FCounter := FCounter + UniQuery1.FetchRows;
Application.ProcessMessages;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
FCounter:= 0;
UniQuery1.SpecificOptions.Values['FetchAll'] := 'false';
UniQuery1.FetchRows := 25;
UniQuery1.Options.QueryRecCount := true;
UniQuery1.Open;
UniQuery1.Last;
end;
Hello,
For the mapping of the data-getting process in ClientDataSet you should set the ClientDataSet.PacketRecord property equal to UniQuery.FetchRows and use the ClientDataSet.GetData event for the mapping of the data-getting process
For the mapping of the data-getting process in ClientDataSet you should set the ClientDataSet.PacketRecord property equal to UniQuery.FetchRows and use the ClientDataSet.GetData event for the mapping of the data-getting process
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientDataSet1.PacketRecords := 25;
ClientDataSet1.Open;
while not ClientDataSet1.eof do
ClientDataSet1.next;
end;
procedure TForm1.DataSetProvider1GetData(Sender: TObject;
DataSet: TCustomClientDataSet);
begin
if ClientDataSet1.Active then ShowMessage(IntToStr(ClientDataSet1.RecordCount));
end;
Hello,
The FRecordCount field is a protected field of the class, and UniQuery retrieves the value of this field with the help of the RecordCount event. There are special methods implemented for retrieving the number of records depending on the UniQuery. settings. So, if you have even got access to the FRecordCount event, then, most probably, you will retrieve the wrong number of records.
The FRecordCount field is a protected field of the class, and UniQuery retrieves the value of this field with the help of the RecordCount event. There are special methods implemented for retrieving the number of records depending on the UniQuery. settings. So, if you have even got access to the FRecordCount event, then, most probably, you will retrieve the wrong number of records.