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 68 of file CondPyInterface.h.

Constructor & Destructor Documentation

cond::RDBMS::RDBMS ( )

Definition at line 194 of file CondPyInterface.cc.

References cond::CmsDefaults, and connection.

194  : connection(new DbConnection) {
195  //topinit();
196  connection->configure( cond::CmsDefaults );
197  }
boost::shared_ptr< DbConnection > connection
cond::RDBMS::~RDBMS ( )

Definition at line 198 of file CondPyInterface.cc.

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

Definition at line 200 of file CondPyInterface.cc.

References connection, and Debug.

200  : connection(new DbConnection) {
201  //topinit();
202  connection->configuration().setAuthenticationPath(authPath);
203  if (debug)
204  connection->configuration().setMessageLevel( coral::Debug );
205  else
206  connection->configuration().setMessageLevel( coral::Error );
207  connection->configuration().setPoolAutomaticCleanUp( false );
208  connection->configuration().setConnectionTimeOut(0);
209 
210  connection->configure();
211  }
boost::shared_ptr< DbConnection > connection
#define debug
Definition: MEtoEDMFormat.h:34
const bool Debug
cond::RDBMS::RDBMS ( std::string const &  user,
std::string const &  pass 
)

Definition at line 213 of file CondPyInterface.cc.

References connection.

213  : connection(new DbConnection) {
214  //topinit();
215  std::string userenv(std::string("CORAL_AUTH_USER=")+user);
216  std::string passenv(std::string("CORAL_AUTH_PASSWORD=")+pass);
217  ::putenv(const_cast<char*>(userenv.c_str()));
218  ::putenv(const_cast<char*>(passenv.c_str()));
219  connection->configuration().setMessageLevel( coral::Error );
220  connection->configuration().setPoolAutomaticCleanUp( false );
221  connection->configuration().setConnectionTimeOut(0);
222  connection->configure();
223  }
boost::shared_ptr< DbConnection > connection

Member Function Documentation

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

Definition at line 233 of file CondPyInterface.cc.

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

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

233  {
234  DbSession dbSession = connection->createSession();
235  dbSession.open( db );
236  return CondDB(dbSession,logger);
237  }
boost::shared_ptr< DbConnection > connection
tuple db
Definition: EcalCondDB.py:151
boost::shared_ptr< cond::Logger > logger
CondDB cond::RDBMS::getReadOnlyDB ( std::string const &  db)

Definition at line 239 of file CondPyInterface.cc.

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

Referenced by BOOST_PYTHON_MODULE().

239  {
240  DbSession dbSession = connection->createSession();
241  dbSession.open( db, true );
242  return CondDB(dbSession,logger);
243  }
boost::shared_ptr< DbConnection > connection
tuple db
Definition: EcalCondDB.py:151
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 245 of file CondPyInterface.cc.

References cond::DbScopedTransaction::commit(), connection, cond::TagCollectionRetriever::getTagCollection(), m_globalTag, cond::DbSession::open(), python.CommonUtils::session, and cond::DbScopedTransaction::start().

Referenced by BOOST_PYTHON_MODULE().

248  {
249  DbSession session = connection->createSession();
250  session.open( connstr );
251  cond::DbScopedTransaction tr(session);
252  tr.start(true);
253  TagCollectionRetriever gtr(session, prefix,postfix);
254  const_cast<GlobalTag&>(m_globalTag).clear();
255  gtr.getTagCollection(gname,const_cast<GlobalTag&>(m_globalTag));
256  tr.commit();
257  return m_globalTag;
258  }
GlobalTag m_globalTag
boost::shared_ptr< DbConnection > connection
void cond::RDBMS::setLogger ( std::string const &  connstr)

Definition at line 225 of file CondPyInterface.cc.

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

Referenced by BOOST_PYTHON_MODULE().

225  {
226  DbSession loggerSession = connection->createSession();
227  loggerSession.open( connstr );
228  logger.reset(new cond::Logger(loggerSession));
229  }
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 86 of file CondPyInterface.h.

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

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

Definition at line 87 of file CondPyInterface.h.

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

GlobalTag cond::RDBMS::m_globalTag
private

Definition at line 88 of file CondPyInterface.h.

Referenced by globalTag().