Skip to content
Permalink
Browse files

Issue #722: Tweak TMySQLConnection.GetLastErrorMsg so it shows an add…

…itional more helpful message what the user could do to solve his SSL connection error
  • Loading branch information...
ansgarbecker committed Jul 23, 2019
1 parent ae95c2f commit 4b84ffa7ef3cd81e630df57c245be96183c9dd47
Showing with 24 additions and 9 deletions.
  1. +5 −1 out/locale/en/LC_MESSAGES/default.po
  2. +19 −8 source/dbconnection.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-07-14 19:44+0200\n"
"PO-Revision-Date: 2019-07-23 21:57+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n"
@@ -4764,6 +4764,10 @@ msgstr "Uptime"
msgid "unknown"
msgstr "unknown"

#. Give the user some hint what he can do with his SSL related connection error
msgid "Please select a different library in your session settings. (Current: \"%s\")"
msgstr "Please select a different library in your session settings. (Current: \"%s\")"

#: main.pas:5261
msgid "Specify filter-value..."
msgstr "Specify filter-value..."
@@ -3289,16 +3289,27 @@ function TMySQLConnection.GetLastErrorMsg: String;
rx: TRegExpr;
begin
Result := '';
Additional := '';

Msg := DecodeAPIString(FLib.mysql_error(FHandle));
// Find "(errno: 123)" in message and add more meaningful message from perror.exe
rx := TRegExpr.Create;
rx.Expression := '.+\(errno\:\s+(\d+)\)';
if rx.Exec(Msg) then begin
Additional := MySQLErrorCodes.Values[rx.Match[1]];
if Additional <> '' then
Msg := Msg + CRLF + CRLF + Additional;

if SynRegExpr.ExecRegExpr('(Unknown SSL error|SSL connection error)', Msg) then begin
// Find specific strings in error message and provide helpful message
Additional := f_('Please select a different library in your session settings. (Current: "%s")', [FParameters.LibraryFile]);
end else begin
// Find "(errno: 123)" in message and add more meaningful message from perror.exe
rx := TRegExpr.Create;
rx.Expression := '.+\(errno\:\s+(\d+)\)';
if rx.Exec(Msg) then begin
Additional := MySQLErrorCodes.Values[rx.Match[1]];
end;
rx.Free;
end;
rx.Free;

if Additional <> '' then begin
Msg := Msg + sLineBreak + sLineBreak + Additional;
end;

case FStatementNum of
0: Result := Msg;
1: Result := f_(MsgSQLError, [LastErrorCode, Msg]);

0 comments on commit 4b84ffa

Please sign in to comment.
You can’t perform that action at this time.