From a88109b85c955a01fbd604b52270c9a1a98f020b Mon Sep 17 00:00:00 2001 From: David Pierron Date: Mon, 28 Jun 2021 13:14:55 +0200 Subject: [PATCH] If a packet generates a SQL error 1366 (invalid encoding), it'll be discarded from the queue and never sent to the database again. --- 02_Windows_App/Perun_v1/01_Classes/DatabaseController.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/02_Windows_App/Perun_v1/01_Classes/DatabaseController.cs b/02_Windows_App/Perun_v1/01_Classes/DatabaseController.cs index b82b003..019590a 100644 --- a/02_Windows_App/Perun_v1/01_Classes/DatabaseController.cs +++ b/02_Windows_App/Perun_v1/01_Classes/DatabaseController.cs @@ -261,6 +261,14 @@ public class DatabaseController DatabaseStatus = true; // True as connection is not broken ReturnValue = 1; // Return a value to remove this query from quae break; + case 1366: // Invalid character + PerunHelper.LogError(ref Globals.AppLogHistory, $"ERROR MySQL - error id: {m_ex.Number}", 1, 1, TCPFrameType); + PerunHelper.LogError(ref Globals.AppLogHistory, $"ERROR MySQL - query: {SQLQueryTxt}", 1, 1, TCPFrameType); + PerunHelper.LogError(ref Globals.AppLogHistory, $"ERROR MySQL - error: {m_ex.Message}", 1, 1, TCPFrameType); + PerunHelper.LogError(ref Globals.AppLogHistory, $"ERROR MySQL - frame skipped, it will not be saved to the database", 1, 1, TCPFrameType); + DatabaseStatus = true; // True as connection is not broken + ReturnValue = 1; // Return a value to remove this query from queue + break; default: // Default error handler PerunHelper.LogError(ref Globals.AppLogHistory, $"ERROR MySQL - error id: {m_ex.Number}", 1, 1, TCPFrameType); PerunHelper.LogError(ref Globals.AppLogHistory, $"ERROR MySQL - query: {SQLQueryTxt}", 1, 1, TCPFrameType);