Skip to content
Permalink
Browse files

Fix wrong data shown in data tab, when switching between a table/data…

…base with the same name on different servers
  • Loading branch information...
ansgarbecker committed Jun 22, 2019
1 parent c844032 commit c91ab241e33147f3f3fe38fe4af5a5e60504ade6
Showing with 5 additions and 6 deletions.
  1. +5 −6 source/main.pas
@@ -1123,8 +1123,7 @@ TMainForm = class(TForm)
DataGridHiddenColumns: TStringList;
DataGridSortColumns: TOrderColArray;
DataGridWantedRowCount: Int64;
DataGridDB: String;
DataGridTable: String;
DataGridTable: TDBObject;
DataGridFocusedCell: TStringList;
DataGridFocusedNodeIndex: Int64;
DataGridFocusedColumnName: String;
@@ -5139,7 +5138,8 @@ procedure TMainForm.DataGridBeforePaint(Sender: TBaseVirtualTree; TargetCanvas:
lblSorryNoData.Parent := tabData;

// Indicates whether the current table data is just refreshed or if we're in another table
RefreshingData := (ActiveDatabase = DataGridDB) and (DBObj.Name = DataGridTable);
// ... or maybe in a table/database with the same name on a different server
RefreshingData := DBObj.IsSameAs(DataGridTable);

// Load last view settings
HandleDataGridAttributes(RefreshingData);
@@ -5154,8 +5154,7 @@ procedure TMainForm.DataGridBeforePaint(Sender: TBaseVirtualTree; TargetCanvas:
ColWidths.Values[vt.Header.Columns[i].Text] := IntToStr(vt.Header.Columns[i].Width);
end;

DataGridDB := DBObj.Database;
DataGridTable := DBObj.Name;
DataGridTable := DBObj;

Select := '';
// Ensure key columns are included to enable editing
@@ -9673,7 +9672,7 @@ procedure TMainForm.HandleDataGridAttributes(RefreshingData: Boolean);
DataGridFocusedCell := TStringList.Create;
// Remember focused node and column for selected table
if Assigned(DataGrid.FocusedNode) then begin
KeyName := ActiveConnection.QuoteIdent(DataGridDB)+'.'+ActiveConnection.QuoteIdent(DataGridTable);
KeyName := ActiveConnection.QuoteIdent(DataGridTable.Database)+'.'+ActiveConnection.QuoteIdent(DataGridTable.Name);
FocusedCol := '';
if DataGrid.FocusedColumn > NoColumn then
FocusedCol := DataGrid.Header.Columns[DataGrid.FocusedColumn].Text;

0 comments on commit c91ab24

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