Store last used database directly, not only when closing a session. Closes #983

This commit is contained in:
Ansgar Becker
2020-04-11 13:34:17 +02:00
parent 7d16005d2c
commit 12606e7de3
2 changed files with 7 additions and 2 deletions

View File

@@ -3555,6 +3555,13 @@ begin
Query(GetSQLSpecifity(spUSEQuery, [s]), False);
// FDatabase is set via DetectUSEQuery
end;
// Save last used database in session, see #983
if not FParameters.SessionName.IsEmpty then begin
AppSettings.SessionPath := FParameters.SessionPath;
AppSettings.WriteString(asLastUsedDB, Value);
end;
if Assigned(FOnObjectnamesChanged) then
FOnObjectnamesChanged(Self, FDatabase);
end;

View File

@@ -2457,8 +2457,6 @@ begin
RefreshHelperNode(HELPERNODE_COLUMNS);
// Last chance to access connection related properties before disconnecting
AppSettings.SessionPath := Item.Parameters.SessionPath;
AppSettings.WriteString(asLastUsedDB, Item.Database);
// Disconnect
Item.Active := False;