CMS 3D CMS Logo

Public Member Functions | Private Attributes

cond::RDBMS Class Reference

#include <CondPyInterface.h>

List of all members.

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 &user, std::string const &pass)
 RDBMS (std::string const &authPath, bool debug=false)
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.

               : connection(new DbConnection) {
    //topinit();
    connection->configure( cond::CmsDefaults );
  }
cond::RDBMS::~RDBMS ( )

Definition at line 198 of file CondPyInterface.cc.

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

Definition at line 200 of file CondPyInterface.cc.

References connection, and Debug.

                                                      : connection(new DbConnection) {
    //topinit();
    connection->configuration().setAuthenticationPath(authPath);
    if (debug) 
      connection->configuration().setMessageLevel( coral::Debug );
    else
      connection->configuration().setMessageLevel( coral::Error );
    connection->configuration().setPoolAutomaticCleanUp( false );
    connection->configuration().setConnectionTimeOut(0);

    connection->configure();
  }
cond::RDBMS::RDBMS ( std::string const &  user,
std::string const &  pass 
)

Definition at line 213 of file CondPyInterface.cc.

References connection.

                                                            : connection(new DbConnection) {
    //topinit();
    std::string userenv(std::string("CORAL_AUTH_USER=")+user);
    std::string passenv(std::string("CORAL_AUTH_PASSWORD=")+pass);
    ::putenv(const_cast<char*>(userenv.c_str()));
    ::putenv(const_cast<char*>(passenv.c_str()));
    connection->configuration().setMessageLevel( coral::Error );
    connection->configuration().setPoolAutomaticCleanUp( false );
    connection->configuration().setConnectionTimeOut(0);
    connection->configure();
  }

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().

                                          {
    DbSession dbSession = connection->createSession();
    dbSession.open( db );
    return CondDB(dbSession,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().

                                                  {
    DbSession dbSession = connection->createSession();
    dbSession.open( db, true );
    return CondDB(dbSession,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().

                                                                       {
    DbSession session = connection->createSession();
    session.open( connstr );
    cond::DbScopedTransaction tr(session);
    tr.start(true);
    TagCollectionRetriever gtr(session, prefix,postfix);
    const_cast<GlobalTag&>(m_globalTag).clear();
    gtr.getTagCollection(gname,const_cast<GlobalTag&>(m_globalTag));
    tr.commit();
    return m_globalTag;  
  }
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().

                                                 {
    DbSession loggerSession = connection->createSession();
    loggerSession.open( connstr );
    logger.reset(new cond::Logger(loggerSession));
  }

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().

Definition at line 88 of file CondPyInterface.h.

Referenced by globalTag().