From d6a0b157208f209e3ef50c5e9db362599e3cf6b9 Mon Sep 17 00:00:00 2001 From: Dario Date: Wed, 15 Jul 2020 13:11:04 +0200 Subject: [PATCH] add reporting for mysql connections, to find error with mysql querys --- src/cpp/SingletonManager/ConnectionManager.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/cpp/SingletonManager/ConnectionManager.h b/src/cpp/SingletonManager/ConnectionManager.h index 90ad7cd93..332f4c2d4 100644 --- a/src/cpp/SingletonManager/ConnectionManager.h +++ b/src/cpp/SingletonManager/ConnectionManager.h @@ -37,18 +37,15 @@ public: inline Poco::Data::Session getConnection(ConnectionType type) { Poco::ScopedLock _lock(mWorkingMutex); - - switch (type) - { - case CONNECTION_MYSQL_LOGIN_SERVER: - case CONNECTION_MYSQL_PHP_SERVER: - return mSessionPools.getPool(mSessionPoolNames[type]).get(); - default: + + if (CONNECTION_MYSQL_LOGIN_SERVER != type && CONNECTION_MYSQL_PHP_SERVER != type) { addError(new ParamError("[ConnectionManager::getConnection]", "Connection Type unknown", std::to_string(type))); - break; + throw Poco::NotFoundException("Connection Type unknown", std::to_string(type)); } - throw Poco::NotFoundException("Connection Type unknown", std::to_string(type)); - //return Poco::Data::Session(nullptr); + auto session = mSessionPools.getPool(mSessionPoolNames[type]).get(); + std::string dateTimeString = Poco::DateTimeFormatter::format(Poco::DateTime(), "%d.%m.%y %H:%M:%S"); + printf("[getConnection] %s impl: %p\n", dateTimeString.data(), session.impl()); + return session; } protected: