Skip to content
Snippets Groups Projects
Commit c0786b1d authored by Marco De Marco's avatar Marco De Marco
Browse files

Mysql server is gone away fix

parent 10536f19
Branches
Tags
No related merge requests found
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <soci/mysql/soci-mysql.h> #include <soci/mysql/soci-mysql.h>
#include <soci/use.h> #include <soci/use.h>
#include <mysql.h>
namespace MetadataExporter_ns namespace MetadataExporter_ns
{ {
...@@ -62,7 +64,18 @@ void DBManager::connect() throw(soci::soci_error) ...@@ -62,7 +64,18 @@ void DBManager::connect() throw(soci::soci_error)
#endif #endif
for(unsigned int i=0; i<connectionNumber; ++i) for(unsigned int i=0; i<connectionNumber; ++i)
{
m_connectionPool_sp->at(i).open(soci::mysql, connection.str()); m_connectionPool_sp->at(i).open(soci::mysql, connection.str());
soci::mysql_session_backend* backend =
static_cast<soci::mysql_session_backend*>(
m_connectionPool_sp->at(i).get_backend());
MYSQL* mysql = backend->conn_;
bool reconnect = true;
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
}
} }
//============================================================================== //==============================================================================
......
...@@ -30,7 +30,7 @@ Server::Server(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_ ...@@ -30,7 +30,7 @@ Server::Server(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_
} }
//============================================================================== //==============================================================================
// Server::Server() // Server::~Server()
//============================================================================== //==============================================================================
Server::~Server() Server::~Server()
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment