CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
cond::RDBMS Class Reference

#include <CondPyInterface.h>

Public Member Functions

CondDB getDB (std::string const &db)
 
CondDB getReadOnlyDB (std::string const &db)
 
GlobalTag const & globalTag (std::string const &connstr, std::string const &gname, std::string const &prefix, std::string const &postfix) const
 
 RDBMS ()
 
 RDBMS (std::string const &authPath, bool debug=false)
 
 RDBMS (std::string const &user, std::string const &pass)
 
void setLogger (std::string const &connstr)
 
 ~RDBMS ()
 

Private Attributes

boost::shared_ptr< DbConnectionconnection
 
boost::shared_ptr< cond::Loggerlogger
 
GlobalTag m_globalTag
 

Detailed Description

Definition at line 74 of file CondPyInterface.h.

Constructor & Destructor Documentation

cond::RDBMS::RDBMS ( )

Definition at line 206 of file CondPyInterface.cc.

References cond::CmsDefaults, and connection.

206  : connection(new DbConnection) {
207  //topinit();
208  connection->configure( cond::CmsDefaults );
209  }
boost::shared_ptr< DbConnection > connection
cond::RDBMS::~RDBMS ( )

Definition at line 210 of file CondPyInterface.cc.

210 {}
cond::RDBMS::RDBMS ( std::string const &  authPath,
bool  debug = false 
)
explicit

Definition at line 212 of file CondPyInterface.cc.

References connection, and Debug.

212  : connection(new DbConnection) {
213  //topinit();
214  connection->configuration().setAuthenticationPath(authPath);
215  if (debug)
216  connection->configuration().setMessageLevel( coral::Debug );
217  else
218  connection->configuration().setMessageLevel( coral::Error );
219  connection->configuration().setPoolAutomaticCleanUp( false );
220  connection->configuration().setConnectionTimeOut(0);
221 
222  connection->configure();
223  }
boost::shared_ptr< DbConnection > connection
#define debug
Definition: HDRShower.cc:19
const bool Debug
cond::RDBMS::RDBMS ( std::string const &  user,
std::string const &  pass 
)

Definition at line 225 of file CondPyInterface.cc.

References connection, and AlCaHLTBitMon_QueryRunRegistry::string.

225  : connection(new DbConnection) {
226  //topinit();
227  std::string userenv(std::string("CORAL_AUTH_USER=")+user);
228  std::string passenv(std::string("CORAL_AUTH_PASSWORD=")+pass);
229  ::putenv(const_cast<char*>(userenv.c_str()));
230  ::putenv(const_cast<char*>(passenv.c_str()));
231  connection->configuration().setMessageLevel( coral::Error );
232  connection->configuration().setPoolAutomaticCleanUp( false );
233  connection->configuration().setConnectionTimeOut(0);
234  connection->configure();
235  }
boost::shared_ptr< DbConnection > connection

Member Function Documentation

CondDB cond::RDBMS::getDB ( std::string const &  db)

Definition at line 245 of file CondPyInterface.cc.

References cond::Auth::COND_WRITER_ROLE, connection, logger, and cond::DbSession::open().

Referenced by BOOST_PYTHON_MODULE(), and CondBasicIter::create().

245  {
246  DbSession dbSession = connection->createSession();
247  dbSession.open( db, cond::Auth::COND_WRITER_ROLE );
248  return CondDB(dbSession,logger);
249  }
boost::shared_ptr< DbConnection > connection
tuple db
Definition: EcalCondDB.py:151
static const std::string COND_WRITER_ROLE
Definition: Auth.h:18
boost::shared_ptr< cond::Logger > logger
CondDB cond::RDBMS::getReadOnlyDB ( std::string const &  db)

Definition at line 251 of file CondPyInterface.cc.

References cond::Auth::COND_READER_ROLE, connection, logger, and cond::DbSession::open().

Referenced by BOOST_PYTHON_MODULE().

251  {
252  DbSession dbSession = connection->createSession();
253  dbSession.open( db, cond::Auth::COND_READER_ROLE, true );
254  return CondDB(dbSession,logger);
255  }
boost::shared_ptr< DbConnection > connection
tuple db
Definition: EcalCondDB.py:151
static const std::string COND_READER_ROLE
Definition: Auth.h:19
boost::shared_ptr< cond::Logger > logger
GlobalTag const & cond::RDBMS::globalTag ( std::string const &  connstr,
std::string const &  gname,
std::string const &  prefix,
std::string const &  postfix 
) const

Definition at line 257 of file CondPyInterface.cc.

References hitfit::clear(), cond::DbTransaction::commit(), connection, cond::TagCollectionRetriever::getTagCollection(), m_globalTag, cond::DbSession::open(), python.CommonUtils::session, cond::DbTransaction::start(), and cond::DbSession::transaction().

Referenced by BOOST_PYTHON_MODULE().

260  {
261  DbSession session = connection->createSession();
262  session.open( connstr, true );
263  session.transaction().start( true );
264  TagCollectionRetriever gtr(session, prefix,postfix);
265  const_cast<GlobalTag&>(m_globalTag).clear();
266  gtr.getTagCollection(gname,const_cast<GlobalTag&>(m_globalTag));
267  session.transaction().commit();
268  return m_globalTag;
269  }
GlobalTag m_globalTag
boost::shared_ptr< DbConnection > connection
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
void cond::RDBMS::setLogger ( std::string const &  connstr)

Definition at line 237 of file CondPyInterface.cc.

References connection, and logger.

Referenced by BOOST_PYTHON_MODULE().

237  {
238  DbSession loggerSession = connection->createSession();
239  logger.reset(new cond::Logger(loggerSession));
240  logger->connect( connstr, true );
241  }
boost::shared_ptr< DbConnection > connection
boost::shared_ptr< cond::Logger > logger

Member Data Documentation

boost::shared_ptr<DbConnection> cond::RDBMS::connection
private

Definition at line 92 of file CondPyInterface.h.

Referenced by getDB(), getReadOnlyDB(), globalTag(), RDBMS(), and setLogger().

boost::shared_ptr<cond::Logger> cond::RDBMS::logger
private

Definition at line 93 of file CondPyInterface.h.

Referenced by getDB(), getReadOnlyDB(), and setLogger().

GlobalTag cond::RDBMS::m_globalTag
private

Definition at line 94 of file CondPyInterface.h.

Referenced by globalTag().