Silence conversion errors while reading query history from registry. See pm from Thomas Hauck.

This commit is contained in:
Ansgar Becker
2012-08-27 15:33:18 +00:00
parent e492421153
commit e686ea171b

View File

@ -11057,19 +11057,27 @@ begin
// Prevent from running into serious errors when registry has some non-numeric value // Prevent from running into serious errors when registry has some non-numeric value
if j<>-1 then begin if j<>-1 then begin
Item := TQueryHistoryItem.Create; Item := TQueryHistoryItem.Create;
Item.RegValue := j; try
Raw := AppSettings.ReadString(ValueNames[i]); Item.RegValue := j;
p := Pos(DELIM, Raw); Raw := AppSettings.ReadString(ValueNames[i]);
Item.Time := StrToDateTime(Copy(Raw, 1, p-1)); p := Pos(DELIM, Raw);
System.Delete(Raw, 1, p); Item.Time := StrToDateTime(Copy(Raw, 1, p-1));
p := Pos(DELIM, Raw); System.Delete(Raw, 1, p);
Item.Database := Copy(Raw, 1, p-1); p := Pos(DELIM, Raw);
System.Delete(Raw, 1, p); Item.Database := Copy(Raw, 1, p-1);
p := Pos(DELIM, Raw); System.Delete(Raw, 1, p);
Item.Duration := StrToIntDef(Copy(Raw, 1, p-1), 0); p := Pos(DELIM, Raw);
FMaxDuration := Max(FMaxDuration, Item.Duration); Item.Duration := StrToIntDef(Copy(Raw, 1, p-1), 0);
Item.SQL := Copy(Raw, p+1, Length(Raw)); FMaxDuration := Max(FMaxDuration, Item.Duration);
Add(Item); Item.SQL := Copy(Raw, p+1, Length(Raw));
Add(Item);
except
on E:Exception do begin
MainForm.LogSQL(E.ClassName+': '+E.Message, lcError);
Item.Free;
Continue;
end;
end;
end; end;
end; end;
// Sort by date // Sort by date