From cc40367936afa3fae909fd4f27d3a36b74a9db50 Mon Sep 17 00:00:00 2001 From: evan-miller-jumpmind <70151986+evan-miller-jumpmind@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:14:28 -0500 Subject: [PATCH] 0005698: Prevented data truncation error when inserting/updating log event in sym_monitor_event on Interbase --- .../jumpmind/symmetric/monitor/MonitorTypeLog.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/symmetric-core/src/main/java/org/jumpmind/symmetric/monitor/MonitorTypeLog.java b/symmetric-core/src/main/java/org/jumpmind/symmetric/monitor/MonitorTypeLog.java index e6b8297dec..2b9d4fd8b2 100644 --- a/symmetric-core/src/main/java/org/jumpmind/symmetric/monitor/MonitorTypeLog.java +++ b/symmetric-core/src/main/java/org/jumpmind/symmetric/monitor/MonitorTypeLog.java @@ -24,6 +24,8 @@ import java.util.Collections; import java.util.List; +import org.jumpmind.db.platform.interbase.InterbaseDatabasePlatform; +import org.jumpmind.db.platform.interbase.InterbaseDdlBuilder; import org.jumpmind.extension.IBuiltInExtensionPoint; import org.jumpmind.symmetric.ISymmetricEngine; import org.jumpmind.symmetric.ext.ISymmetricEngineAware; @@ -60,9 +62,19 @@ public MonitorEvent check(Monitor monitor) { for (LogSummary logSummary : all) { count += logSummary.getCount(); } - event.setDetails(serializeDetails(all)); event.setValue(all.size()); event.setCount(count); + String details = serializeDetails(all); + if (engine.getDatabasePlatform() instanceof InterbaseDatabasePlatform) { + while (details != null && details.length() > InterbaseDdlBuilder.SWITCH_TO_LONGVARCHAR_SIZE && all.size() > 1) { + all.remove(all.size() - 1); + details = serializeDetails(all); + } + if (details != null && details.length() > InterbaseDdlBuilder.SWITCH_TO_LONGVARCHAR_SIZE) { + details = details.substring(0, InterbaseDdlBuilder.SWITCH_TO_LONGVARCHAR_SIZE); + } + } + event.setDetails(details); return event; }