Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:23

0001 #include "RecoLuminosity/LumiProducer/interface/DBService.h"
0002 #include "RecoLuminosity/LumiProducer/interface/DBConfig.h"
0003 #include "RelationalAccess/ConnectionService.h"
0004 #include "CoralBase/Exception.h"
0005 #include "RelationalAccess/ISessionProxy.h"
0006 #include "RelationalAccess/AccessMode.h"
0007 
0008 #include <iostream>
0009 lumi::service::DBService::DBService(const edm::ParameterSet& iConfig)
0010     : m_svc(std::make_unique<coral::ConnectionService>()), m_dbconfig(std::make_unique<lumi::DBConfig>(*m_svc)) {
0011   std::string authpath = iConfig.getUntrackedParameter<std::string>("authPath", "");
0012   if (!authpath.empty()) {
0013     m_dbconfig->setAuthentication(authpath);
0014   }
0015 }
0016 
0017 lumi::service::DBService::~DBService() {}
0018 
0019 lumi::service::ISessionProxyPtr lumi::service::DBService::connectReadOnly(const std::string& connectstring) {
0020   std::unique_lock<std::mutex> lock(m_mutex);
0021 
0022   return ISessionProxyPtr(std::unique_ptr<coral::ISessionProxy>(m_svc->connect(connectstring, coral::ReadOnly)),
0023                           std::move(lock));
0024 }