Fix crash after unsuccessful reconnection attempt

This commit is contained in:
2022-10-19 15:43:08 +02:00
parent d1f313bbf9
commit 851155785c
+11
View File
@@ -111,10 +111,21 @@ std::shared_ptr<MySQLResultSetImpl> MySQLClientImpl::ExecuteQuery(const std::str
if (!m_connected) if (!m_connected)
{ {
if (m_automaticReconnect) if (m_automaticReconnect)
{
InternalConnect(); InternalConnect();
if (!m_connected)
{
std::stringstream ss;
ss << "MySQLClientImpl::ExecuteQuery() - Error: Reconnect failed" << std::endl;
ss << "Query: " << query << std::endl;
Logging::Log(Logging::Severity::Error, ss.str());
}
}
else else
{
throw std::runtime_error("MySQLClientImpl::ExecuteQuery() - Not connected to a Database Server"); throw std::runtime_error("MySQLClientImpl::ExecuteQuery() - Not connected to a Database Server");
} }
}
try try
{ {