Improve reconnection behavior
This commit is contained in:
@@ -72,9 +72,21 @@ void MySQLClientImpl::Execute(const std::string& query)
|
|||||||
if (!m_connected)
|
if (!m_connected)
|
||||||
{
|
{
|
||||||
if (m_automaticReconnect)
|
if (m_automaticReconnect)
|
||||||
|
{
|
||||||
InternalConnect();
|
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
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user