mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
get column name from GridResult (instead of Grid.Header)
This commit is contained in:
@@ -7852,9 +7852,7 @@ begin
|
||||
|
||||
actFollowForeignKey.Enabled := False;
|
||||
if (InDataGrid) then begin
|
||||
//get column name from header
|
||||
FocusedColumnName := Grid.Header.Columns[Grid.FocusedColumn].Text;
|
||||
|
||||
FocusedColumnName := Results.ColumnOrgNames[Grid.FocusedColumn];
|
||||
//find foreign key for current column
|
||||
for ForeignKey in ActiveDBObj.TableForeignKeys do begin
|
||||
i := ForeignKey.Columns.IndexOf(FocusedColumnName);
|
||||
@@ -11296,13 +11294,11 @@ begin
|
||||
Results := GridResult(Grid);
|
||||
RowNum := Grid.GetNodeData(Grid.FocusedNode);
|
||||
Results.RecNo := RowNum^;
|
||||
FocusedValue := Results.Col(Grid.FocusedColumn);
|
||||
//get column name from header
|
||||
FocusedColumnName := Grid.Header.Columns[Grid.FocusedColumn].Text;
|
||||
FocusedColumnName := Results.ColumnOrgNames[Grid.FocusedColumn];
|
||||
|
||||
//find foreign key for current column
|
||||
for ForeignKey in ActiveDBObj.TableForeignKeys do begin
|
||||
i := ForeignKey.Columns.IndexOf(Grid.Header.Columns[Grid.FocusedColumn].Text);
|
||||
i := ForeignKey.Columns.IndexOf(FocusedColumnName);
|
||||
if i > -1 then begin
|
||||
ForeignColumnName := ForeignKey.ForeignColumns[i];
|
||||
ReferenceTable := ForeignKey.ReferenceTable;
|
||||
@@ -11324,7 +11320,8 @@ begin
|
||||
end;
|
||||
Node := GetNextNode(ListTables, Node);
|
||||
end;
|
||||
Datatype := ActiveDBObj.TableColumns[Grid.FocusedColumn].DataType;
|
||||
Datatype := Results.DataType(Grid.FocusedColumn);
|
||||
FocusedValue := Results.Col(Grid.FocusedColumn);
|
||||
// filter to show only rows linked by the foreign key
|
||||
SynMemoFilter.UndoList.AddGroupBreak;
|
||||
SynMemoFilter.Text := Results.Connection.QuoteIdent(ForeignColumnName, False) + '=' + Results.Connection.EscapeString(FocusedValue, Datatype);
|
||||
|
||||
Reference in New Issue
Block a user