From 209f398dec7c08b7619c3cd310e9664215cfa2a1 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 7 Mar 2017 20:19:36 +0000 Subject: [PATCH] Silence dumb exceptions from mysql_ping() call. See https://www.heidisql.com/forum.php?t=23483 --- source/dbconnection.pas | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/dbconnection.pas b/source/dbconnection.pas index f1acb33a..5ac4eb77 100644 --- a/source/dbconnection.pas +++ b/source/dbconnection.pas @@ -2253,9 +2253,20 @@ end; function TMySQLConnection.Ping(Reconnect: Boolean): Boolean; +var + IsDead: Boolean; begin Log(lcDebug, 'Ping server ...'); - if (FHandle=nil) or (mysql_ping(FHandle) <> 0) then begin + IsDead := True; + try + IsDead := (FHandle=nil) or (mysql_ping(FHandle) <> 0); + except + // silence dumb exceptions from mysql_ping + on E:Exception do + Log(lcError, E.Message); + end; + + if IsDead then begin // Be sure to release some stuff before reconnecting Active := False; if Reconnect then