Skip to content
Snippets Groups Projects
Commit ac9e1be5 authored by Steven Murray's avatar Steven Murray
Browse files

cta-database-poll now uses rdbms::ConnPool

parent 735c2651
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@
#include "catalogue/PollDatabaseCmd.hpp"
#include "catalogue/PollDatabaseCmdLineArgs.hpp"
#include "rdbms/ConnFactoryFactory.hpp"
#include "rdbms/ConnPool.hpp"
#include <unistd.h>
......@@ -46,12 +47,14 @@ int PollDatabaseCmd::exceptionThrowingMain(const int argc, char *const *const ar
const PollDatabaseCmdLineArgs cmdLineArgs(argc, argv);
const auto dbLogin = rdbms::Login::parseFile(cmdLineArgs.dbConfigPath);
auto factory = rdbms::ConnFactoryFactory::create(dbLogin);
auto conn = factory->create();
const uint64_t nbConns = 1;
rdbms::ConnPool connPool(*factory, nbConns);
uint32_t elapsedSeconds = 0;
for(uint32_t i = 0; i < cmdLineArgs.numberOfSecondsToKeepPolling; i++) {
m_out << "Querying the database" << std::endl;
try {
m_out << "Querying the database" << std::endl;
auto conn = connPool.getConn();
conn->getTableNames();
} catch(exception::Exception &ex) {
m_out << "Database error: " << ex.getMessage().str() << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment