#include <ConnectionManager.h>
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 |
Definition at line 14 of file ConnectionManager.h.
ConnectionManager::ConnectionManager | ( | ) |
Definition at line 9 of file ConnectionManager.cc.
bool ConnectionManager::connect | ( | ) |
Definition at line 20 of file ConnectionManager.cc.
References clean, conn, env, f, keyFile(), alignCSCRings::s, 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 | ( | ) |
Definition at line 44 of file ConnectionManager.cc.
Referenced by HcalChannelQualityXml::getBaseLineFromOmds(), HcalChannelQualityXml::getIovsFromOmds(), HcalAssistant::getListOfChannelsFromDb(), HcalO2OManager::getListOfOmdsIovs(), HcalO2OManager::getListOfOmdsTags(), and HcalChannelQualityXml::getTagsFromOmds().
oracle::occi::Statement * ConnectionManager::getStatement | ( | const std::string & | query | ) |
Definition at line 40 of file ConnectionManager.cc.
Referenced by HcalChannelQualityXml::getBaseLineFromOmds(), HcalChannelQualityXml::getIovsFromOmds(), HcalAssistant::getListOfChannelsFromDb(), HcalO2OManager::getListOfOmdsIovs(), HcalO2OManager::getListOfOmdsTags(), and HcalChannelQualityXml::getTagsFromOmds().
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().