Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 16 Jun 2025, 08:54

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 08 Jun 2025, 01:07 
Offline

Joined: 13 Jul 2019, 19:08
Posts: 94
If I have the following connection:
"TDBGridEh" -> "TMemTableEh" -> "TDataSetDriverEh" -> "TUniQuery" the searches made in "SearchPanel" are super fast, it seems to have a thread

However, if I have the following connection
"TDBGridEh" -> "TUniQuery"

The searches are slow

Could you explain the problem and give me an alternative so that this second way would be fast too? Could I have the code that makes it fast? Or a hack to achieve this without needing "TMemTableEh"

From what I saw there is a Thread in "DBGridEhToolCtrls" -> "TSearchResultThread"


Top
 Profile  
 
PostPosted: 09 Jun 2025, 12:18 
Offline

Joined: 08 May 2014, 18:06
Posts: 704
Hello Luciano

The SearchPanel uses threads, but they are not involved in the algorithm for searching the next value in the grid.
If you want to understand the search algorithm, set a breakpoint in the TCustomDBGridEh.LocateText method and step through it.
It is possible that the component itself retrieves field values very slowly or moves to the next TUniQuery record inefficiently.
Compare the speed of retrieving all values from your dataset using the following procedure.

Code:
procedure TForm1.GetAllValuesInDataSet(DataSet: TDataSet; Memo: TMemo);
var
  i: Integer;
  FieldValue: String;
  Stopwatch: TStopwatch;
begin
  Memo.Clear;

  if not DataSet.Active or DataSet.IsEmpty then
  begin
    Memo.Lines.Add('DataSet is empty or not active.');
    Exit;
  end;

  Stopwatch := TStopwatch.StartNew;
  DataSet.DisableControls;
  try
    DataSet.First;
    while not DataSet.Eof do
    begin
//      Memo.Lines.Add('--- Record ---');
      for i := 0 to DataSet.FieldCount - 1 do
      begin
        FieldValue := DataSet.Fields[i].DisplayText;
//        Memo.Lines.Add(Format('%s = %s',
//          [DataSet.Fields[i].FieldName, VarToStr(FieldValue)]));
      end;
      DataSet.Next;
    end;
  finally
    DataSet.EnableControls;
  end;
  Stopwatch.Stop;

  Memo.Lines.Add(Format('Execution time: %d ms', [Stopwatch.ElapsedMilliseconds]));
end;

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group