Skip to content
Permalink
Browse files

Issue #654: reduce very frequent calls to Application.ProcessMessages…

… while import dialog shows, down from 1 call per command to 1 call per second
  • Loading branch information...
ansgarbecker committed Sep 8, 2019
1 parent 7666496 commit 11f25e01f4a201e619ab6f505b17fd4c4455acf3
Showing with 6 additions and 1 deletion.
  1. +6 −1 source/main.pas
@@ -3821,6 +3821,7 @@ procedure TMainForm.RunQueryFile(FileName: String; Encoding: TEncoding);
Filesize, QueryCount, ErrorCount, RowsAffected, Position: Int64;
Queries: TSQLBatch;
i: Integer;
LastProcessMessages: Cardinal;

procedure StopProgress;
begin
@@ -3845,6 +3846,7 @@ procedure TMainForm.RunQueryFile(FileName: String; Encoding: TEncoding);
ErrorCount := 0;
Position := 0;
RowsAffected := 0;
LastProcessMessages := GetTickCount;
LinesRemain := '';
Queries := TSQLBatch.Create;

@@ -3892,7 +3894,10 @@ procedure TMainForm.RunQueryFile(FileName: String; Encoding: TEncoding);
Dummy
);
Dialog.SetProgress64(Position, FileSize);
Application.ProcessMessages;
if GetTickCount - LastProcessMessages > 1000 then begin
Application.ProcessMessages;
LastProcessMessages := GetTickCount;
end;

// Execute single query
// Break or don't break loop, depending on the state of "Stop on errors" button

0 comments on commit 11f25e0

Please sign in to comment.
You can’t perform that action at this time.