From 59bb71578559cc39d42befe0440101cff30d3425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Tue, 6 Oct 2020 13:56:16 +0200 Subject: [PATCH] Fixed counter increment when no conversion is provided to 'get_status_variables' --- lib/MySQL_Thread.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/MySQL_Thread.cpp b/lib/MySQL_Thread.cpp index 771e34509..e2f141939 100644 --- a/lib/MySQL_Thread.cpp +++ b/lib/MySQL_Thread.cpp @@ -5959,11 +5959,16 @@ unsigned long long MySQL_Threads_Handler::get_status_variable( } } if (m_idx != p_th_counter::__size) { + const auto& cur_val = status_variables.p_counter_array[m_idx]->Value(); + double final_val = 0; + if (conv != 0) { - const auto& cur_val = status_variables.p_counter_array[m_idx]->Value(); - const auto& final_val = (q - (cur_val / conv)) * conv; - status_variables.p_counter_array[m_idx]->Increment(final_val); + final_val = (q - (cur_val / conv)) * conv; + } else { + final_val = q - cur_val; } + + status_variables.p_counter_array[m_idx]->Increment(final_val); } return q;