From 4b5847c6418eda9592f26339c3700ba55befd89c Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Wed, 16 Nov 2011 19:20:07 +0000 Subject: [PATCH] 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. --- source/dbconnection.pas | 1 + source/main.pas | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index 532dbe7a..16a2d0d4 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -4451,6 +4451,7 @@ begin Size := s.Size; FCreateCode := s.FCreateCode; FCreateCodeFetched := s.FCreateCodeFetched; + FViewSelectCode := s.FViewSelectCode; end else inherited; end; diff --git a/source/main.pas b/source/main.pas index d37ae228..3455e871 100644 --- a/source/main.pas +++ b/source/main.pas @@ -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';