瀏覽代碼

Fix crash after unsuccessful reconnection attempt

JDierkse 3 年之前
父節點
當前提交
851155785c
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      MySQL/MySQLClientImpl.cpp

+ 11 - 0
MySQL/MySQLClientImpl.cpp

@@ -111,9 +111,20 @@ std::shared_ptr<MySQLResultSetImpl> MySQLClientImpl::ExecuteQuery(const std::str
 	if (!m_connected)
 	{
 		if (m_automaticReconnect)
+		{
 			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
+		{
 			throw std::runtime_error("MySQLClientImpl::ExecuteQuery() - Not connected to a Database Server");
+		}
 	}
 
 	try