mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
r3150 didn't fix all exceptions thrown by ListTables.OnGetText when nodes are bound to already freed TDBObjects. Do it right now - introduce a new event TMySQLConnection.OnAfterClearDBObjects for this purpose. Todo: Fix related issue #1723.
This commit is contained in:
@@ -786,6 +786,7 @@ type
|
||||
procedure SaveQueryMemo(Tab: TQueryTab; Filename: String; OnlySelection: Boolean);
|
||||
procedure UpdateFilterPanel(Sender: TObject);
|
||||
procedure DatabaseChanged(Database: String);
|
||||
procedure AfterClearDBObjects(Database: String);
|
||||
function GetBlobContent(Results: TMySQLQuery; Column: Integer): String;
|
||||
procedure DoSearchReplace;
|
||||
procedure UpdateLineCharPanel;
|
||||
@@ -1852,6 +1853,7 @@ begin
|
||||
ListStatus.Tag := VTREE_NOTLOADED;
|
||||
ListProcesses.Tag := VTREE_NOTLOADED;
|
||||
ListCommandstats.Tag := VTREE_NOTLOADED;
|
||||
ListTables.Tag := VTREE_NOTLOADED;
|
||||
|
||||
Application.Title := APPNAME;
|
||||
end;
|
||||
@@ -2535,6 +2537,7 @@ begin
|
||||
ConnectionAttempt := TMySQLConnection.Create(Self);
|
||||
ConnectionAttempt.OnLog := LogSQL;
|
||||
ConnectionAttempt.OnDatabaseChanged := DatabaseChanged;
|
||||
ConnectionAttempt.OnAfterClearDBObjects := AfterClearDBObjects;
|
||||
ConnectionAttempt.ObjectNamesInSelectedDB := SynSQLSyn1.TableNames;
|
||||
ConnectionAttempt.Parameters := Params;
|
||||
try
|
||||
@@ -3814,8 +3817,6 @@ var
|
||||
begin
|
||||
// DB-Properties
|
||||
vt := Sender as TVirtualStringTree;
|
||||
if not Connection.DbObjectsCached(ActiveDatabase) then
|
||||
vt.Tag := VTREE_NOTLOADED;
|
||||
if vt.Tag = VTREE_LOADED then
|
||||
Exit;
|
||||
|
||||
@@ -6615,6 +6616,15 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.AfterClearDBObjects(Database: String);
|
||||
begin
|
||||
if (Database='') or (ActiveDatabase=Database) then begin
|
||||
ListTables.Tag := VTREE_NOTLOADED;
|
||||
ListTables.Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.DBtreeDblClick(Sender: TObject);
|
||||
var
|
||||
Node: PVirtualNode;
|
||||
|
||||
@@ -72,7 +72,7 @@ type
|
||||
|
||||
TMySQLLogCategory = (lcInfo, lcSQL, lcUserFiredSQL, lcError, lcDebug);
|
||||
TMySQLLogEvent = procedure(Msg: String; Category: TMySQLLogCategory=lcInfo) of object;
|
||||
TMySQLDatabaseChangedEvent = procedure(Database: String) of object;
|
||||
TMySQLDatabaseEvent = procedure(Database: String) of object;
|
||||
|
||||
TMySQLQuery = class;
|
||||
TMySQLConnection = class(TComponent)
|
||||
@@ -85,7 +85,8 @@ type
|
||||
FDatabase: String;
|
||||
FLogPrefix: String;
|
||||
FOnLog: TMySQLLogEvent;
|
||||
FOnDatabaseChanged: TMySQLDatabaseChangedEvent;
|
||||
FOnDatabaseChanged: TMySQLDatabaseEvent;
|
||||
FOnAfterClearDBObjects: TMySQLDatabaseEvent;
|
||||
FRowsFound: Int64;
|
||||
FRowsAffected: Int64;
|
||||
FServerVersionUntouched: String;
|
||||
@@ -163,7 +164,8 @@ type
|
||||
property LogPrefix: String read FLogPrefix write FLogPrefix;
|
||||
// Events
|
||||
property OnLog: TMySQLLogEvent read FOnLog write FOnLog;
|
||||
property OnDatabaseChanged: TMySQLDatabaseChangedEvent read FOnDatabaseChanged write FOnDatabaseChanged;
|
||||
property OnDatabaseChanged: TMySQLDatabaseEvent read FOnDatabaseChanged write FOnDatabaseChanged;
|
||||
property OnAfterClearDBObjects: TMySQLDatabaseEvent read FOnAfterClearDBObjects write FOnAfterClearDBObjects;
|
||||
end;
|
||||
|
||||
|
||||
@@ -915,6 +917,8 @@ begin
|
||||
TDBObjectList(FDBObjectLists.Objects[i]).Free;
|
||||
FDBObjectLists.Clear;
|
||||
end;
|
||||
if Assigned(FOnAfterClearDBObjects) then
|
||||
FOnAfterClearDBObjects(db);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user