From a9fd8be2f3734bacdd35fc4329a91a07c84ed124 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 30 Jun 2019 08:59:49 +0200 Subject: [PATCH] Fix new crash in ConnectionInfo (mouse over server version status panel) --- source/dbconnection.pas | 48 ++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index c93718ba..6ca5534c 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -5020,21 +5020,23 @@ var begin Result := Inherited; Result.Values[f_('Client version (%s)', [FLib.DllFile])] := DecodeApiString(FLib.mysql_get_client_info); - Infos := DecodeApiString(FLib.mysql_stat(FHandle)); - rx := TRegExpr.Create; - rx.ModifierG := False; - rx.Expression := '(\S.*)\:\s+(\S*)(\s+|$)'; - if rx.Exec(Infos) then while True do begin - Val := rx.Match[2]; - if LowerCase(rx.Match[1]) = 'uptime' then - Val := FormatTimeNumber(StrToFloatDef(Val, 0), True) - else - Val := FormatNumber(Val); - Result.Values[_(rx.Match[1])] := Val; - if not rx.ExecNext then - break; + if FActive then begin + Infos := DecodeApiString(FLib.mysql_stat(FHandle)); + rx := TRegExpr.Create; + rx.ModifierG := False; + rx.Expression := '(\S.*)\:\s+(\S*)(\s+|$)'; + if rx.Exec(Infos) then while True do begin + Val := rx.Match[2]; + if LowerCase(rx.Match[1]) = 'uptime' then + Val := FormatTimeNumber(StrToFloatDef(Val, 0), True) + else + Val := FormatNumber(Val); + Result.Values[_(rx.Match[1])] := Val; + if not rx.ExecNext then + break; + end; + rx.Free; end; - rx.Free; end; @@ -5044,14 +5046,16 @@ var rx: TRegExpr; begin Result := Inherited; - // clear out password - ConnectionString := FAdoHandle.ConnectionString; - rx := TRegExpr.Create; - rx.ModifierI := True; - rx.Expression := '(\Wpassword=)([^;]*)'; - ConnectionString := rx.Replace(ConnectionString, '${1}******', True); - rx.Free; - Result.Values[_('Connection string')] := ConnectionString; + if FActive then begin + // clear out password + ConnectionString := FAdoHandle.ConnectionString; + rx := TRegExpr.Create; + rx.ModifierI := True; + rx.Expression := '(\Wpassword=)([^;]*)'; + ConnectionString := rx.Replace(ConnectionString, '${1}******', True); + rx.Free; + Result.Values[_('Connection string')] := ConnectionString; + end; end;