Store selected database object and its properties in a copied TDBObject, instead of referencing an item from TDBConnection.FDatabases[x]. Not sure if that's a good idea as there may be logic somewhere which now updates the temporary copy, not the reference. But at least this fixes issue #2579.

This commit is contained in:
Ansgar Becker
2011-11-16 19:20:07 +00:00
parent 0ea3a2cdbb
commit 4b5847c641
2 changed files with 4 additions and 2 deletions

View File

@ -4451,6 +4451,7 @@ begin
Size := s.Size;
FCreateCode := s.FCreateCode;
FCreateCodeFetched := s.FCreateCodeFetched;
FViewSelectCode := s.FViewSelectCode;
end else
inherited;
end;

View File

@ -6793,7 +6793,8 @@ begin
actDataPostChangesExecute(DataGrid);
DBObj := Sender.GetNodeData(Node);
FActiveDbObj := DBObj^;
FActiveDbObj := TDBObject.Create(DBObj.Connection);
FActiveDbObj.Assign(DBObj^);
case FActiveDbObj.NodeType of
lntNone: begin
@ -6861,7 +6862,7 @@ begin
ShowStatusMsg(FActiveDbObj.Connection.Parameters.NetTypeName(FActiveDbObj.Connection.Parameters.NetType, False)+' '+FActiveDbObj.Connection.ServerVersionStr, 3);
end else begin
LogSQL('DBtreeFocusChanged without node.', lcDebug);
FActiveDbObj := nil;
FreeAndNil(FActiveDbObj);
MainTabToActivate := tabHost;
tabHost.Caption := 'Host';
tabDatabase.Caption := 'Database';