diff --git a/src/DBManager.cpp b/src/DBManager.cpp index c01f4c13bba379da8976217cf349336f41252b06..4e9a7cfe50bcae8cecf5c1d12d2448f609c0afd0 100644 --- a/src/DBManager.cpp +++ b/src/DBManager.cpp @@ -58,7 +58,7 @@ void DBManager::connect() throw(soci::soci_error) connection << " password=" << m_configuration_sp->getDatabasePassword(); #ifdef VERBOSE_DEBUG - INFO_STREAM << "CONNECTION: " << connection.str() << endl; + INFO_STREAM << "DBManager::connect(): " << connection.str() << endl; #endif unsigned int connectionNumber = m_configuration_sp->getDatabaseConnectionNumber(); @@ -96,6 +96,9 @@ DBManager::InformationList DBManager::retrieveInformation(std::string schema, soci::session session(*m_connectionPool_sp); + if(session.get_backend() == NULL) + session.reconnect(); + soci::rowset<InformationTuple> rows = (session.prepare << "select " "column_name, column_type, is_nullable from information_schema.columns " "where table_schema like :schema and table_name like :table", @@ -125,6 +128,9 @@ DBManager::RowsetSP DBManager::retrieveNewTuples(std::string schema, soci::session session(*m_connectionPool_sp); + if(session.get_backend() == NULL) + session.reconnect(); + //@workaround: this does not work: timestamp parameter not passed // RowsetSP rows(new soci::rowset<soci::row>((session.prepare << "select * from " // << schema << "." << table << " where update_time > :timestamp " diff --git a/src/DBManager.h b/src/DBManager.h index d0f11959fc4b5c611146b5d106b8368cea41d7a3..0af36a7789aab91b657cd9dde10e5e603036733f 100644 --- a/src/DBManager.h +++ b/src/DBManager.h @@ -62,7 +62,7 @@ public: virtual void disconnect(); //------------------------------------------------------------------------------ -// [Public] Retrieve information schema method +// [Public] Retrieve from information schema method //------------------------------------------------------------------------------ typedef boost::tuple< boost::optional<std::string>, boost::optional<std::string>, boost::optional<std::string> > InformationTuple; @@ -73,7 +73,7 @@ public: std::string) throw(soci::soci_error); //------------------------------------------------------------------------------ -// [Public] Search new tuple method +// [Public] Retrieve new tuple method //------------------------------------------------------------------------------ typedef boost::shared_ptr< soci::rowset<soci::row> > RowsetSP;