CMS 3D CMS Logo

Public Member Functions | Private Attributes

ConnectionManager Class Reference

#include <ConnectionManager.h>

List of all members.

Public Member Functions

bool connect ()
 ConnectionManager ()
void disconnect ()
oracle::occi::Statement * getStatement (const std::string &query)

Private Attributes

oracle::occi::Connection * conn
oracle::occi::Environment * env

Detailed Description

Definition at line 14 of file ConnectionManager.h.


Constructor & Destructor Documentation

ConnectionManager::ConnectionManager ( )

Definition at line 9 of file ConnectionManager.cc.

                                     : env(0), conn(0) {
}

Member Function Documentation

bool ConnectionManager::connect ( )

Definition at line 20 of file ConnectionManager.cc.

References clean, conn, env, f, keyFile(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and indexGenCompare::username.

Referenced by HcalChannelQualityXml::getBaseLineFromOmds(), HcalChannelQualityXml::getIovsFromOmds(), HcalAssistant::getListOfChannelsFromDb(), HcalO2OManager::getListOfOmdsIovs(), HcalO2OManager::getListOfOmdsTags(), and HcalChannelQualityXml::getTagsFromOmds().

                                {
  if (env!=0) return true;
  std::string username,password,database;

  char s[100];
  FILE* f=fopen(keyFile.c_str(),"r");
  s[0]=0; fgets(s,100,f); clean(s); username=s;
  s[0]=0; fgets(s,100,f); clean(s); password=s;
  s[0]=0; fgets(s,100,f); clean(s); database=s;
  fclose(f);

  //  printf("'%s' '%s' '%s'\n",username.c_str(),password.c_str(),database.c_str());
  try {
    env = oracle::occi::Environment::createEnvironment (oracle::occi::Environment::DEFAULT);
    conn = env->createConnection (username, password, database);
  } catch (...) {
    return false;
  }
  return true;
}
void ConnectionManager::disconnect ( )
oracle::occi::Statement * ConnectionManager::getStatement ( const std::string &  query)

Member Data Documentation

oracle::occi::Connection* ConnectionManager::conn [private]

Definition at line 22 of file ConnectionManager.h.

Referenced by connect(), disconnect(), and getStatement().

oracle::occi::Environment* ConnectionManager::env [private]

Definition at line 21 of file ConnectionManager.h.

Referenced by connect(), disconnect(), and getStatement().