Improve reconnection behavior

This commit is contained in:
2025-01-16 14:58:59 +01:00
parent bdbd5cc2df
commit 7b7dfa067b
+12
View File
@@ -72,10 +72,22 @@ void MySQLClientImpl::Execute(const std::string& query)
if (!m_connected)
{
if (m_automaticReconnect)
{
InternalConnect();
if (!m_connected)
{
std::stringstream ss;
ss << "MySQLClientImpl::Execute() - Error: Reconnect failed" << std::endl;
ss << "Query: " << query << std::endl;
Logging::Log(Logging::Severity::Error, ss.str());
return;
}
}
else
{
throw std::runtime_error("MySQLClientImpl::ExecuteQuery() - Not connected to a Database Server");
}
}
try
{