Skip to content

Commit bc8f903

Browse files
committed
fix: hanging in a loop over result nodes by right-click on query result
Refs #2539
1 parent 3d1254d commit bc8f903

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

source/main.pas

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8086,15 +8086,17 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
80868086
menuSQLHelpData.Enabled := InDataGrid;
80878087
Refresh3.Enabled := InDataGrid;
80888088
actGridEditFunction.Enabled := CellFocused;
8089+
actFollowForeignKey.Enabled := False;
80898090

80908091
if not CellFocused then
80918092
Exit;
8093+
if not InDataGrid then
8094+
Exit;
80928095
Results := GridResult(Grid);
80938096

80948097
Datatype := Results.DataType(Grid.FocusedColumn-1);
80958098
Col := Results.Connection.QuoteIdent(Results.ColumnOrgNames[Grid.FocusedColumn-1], False);
8096-
if InDataGrid
8097-
and (Datatype.Index = dbdtJson)
8099+
if (Datatype.Index = dbdtJson)
80988100
and Results.Connection.Parameters.IsAnyPostgreSQL then begin
80998101
Col := Col + '::text';
81008102
end;
@@ -8112,7 +8114,7 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
81128114
HasNotNullValue := False;
81138115
OldDataLocalNumberFormat := DataLocalNumberFormat;
81148116
DataLocalNumberFormat := False;
8115-
IncludedValues := TStringList.Create;
8117+
IncludedValues := TStringList.Create; // Used to skip duplicates
81168118
while Assigned(Node) do begin
81178119
AnyGridEnsureFullRow(Grid, Node);
81188120
RowNumber := Grid.GetNodeData(Node);
@@ -8140,7 +8142,7 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
81408142
end;
81418143
end;
81428144
Node := Grid.GetNextSelected(Node);
8143-
if Length(actQuickFilterFocused1.Hint) > SIZE_MB then
8145+
if Length(actQuickFilterFocused1.Hint) > SIZE_KB then
81448146
Break;
81458147
end;
81468148
DataLocalNumberFormat := OldDataLocalNumberFormat;
@@ -8231,16 +8233,13 @@ procedure TMainForm.popupDataGridPopup(Sender: TObject);
82318233
Act.Caption := StrEllipsis(Act.Hint, 100);
82328234
end;
82338235

8234-
actFollowForeignKey.Enabled := False;
8235-
if (InDataGrid) then begin
8236-
FocusedColumnName := Results.ColumnOrgNames[Grid.FocusedColumn-1];
8237-
//find foreign key for current column
8238-
for ForeignKey in ActiveDBObj.TableForeignKeys do begin
8239-
i := ForeignKey.Columns.IndexOf(FocusedColumnName);
8240-
if i > -1 then begin
8241-
actFollowForeignKey.Enabled := True;
8242-
break;
8243-
end;
8236+
FocusedColumnName := Results.ColumnOrgNames[Grid.FocusedColumn-1];
8237+
//find foreign key for current column
8238+
for ForeignKey in ActiveDBObj.TableForeignKeys do begin
8239+
i := ForeignKey.Columns.IndexOf(FocusedColumnName);
8240+
if i > -1 then begin
8241+
actFollowForeignKey.Enabled := True;
8242+
break;
82448243
end;
82458244
end;
82468245
end;

0 commit comments

Comments
 (0)