TRegistry cannot handle widestrings. Fix restoring last used database name if that contains international characters.

This commit is contained in:
Ansgar Becker
2008-08-19 19:41:10 +00:00
parent f2ed48bf2d
commit 782d941f40

View File

@ -779,7 +779,7 @@ begin
if MainForm.GetRegValue( REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB ) and ( lastUsedDB <> '' ) then if MainForm.GetRegValue( REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB ) and ( lastUsedDB <> '' ) then
begin begin
try try
ActiveDatabase := lastUsedDB; ActiveDatabase := Utf8Decode(lastUsedDB);
except except
// Suppress exception message when db was dropped externally or // Suppress exception message when db was dropped externally or
// the session was just opened with "OnlyDBs" in place and the // the session was just opened with "OnlyDBs" in place and the
@ -972,7 +972,7 @@ begin
// Open server-specific registry-folder. // Open server-specific registry-folder.
// relative from already opened folder! // relative from already opened folder!
reg.OpenKey( REGKEY_SESSIONS + FConn.Description, true ); reg.OpenKey( REGKEY_SESSIONS + FConn.Description, true );
reg.WriteString( REGNAME_LASTUSEDDB, ActiveDatabase ); reg.WriteString( REGNAME_LASTUSEDDB, Utf8Encode(ActiveDatabase) );
end; end;
FreeAndNil(reg); FreeAndNil(reg);