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
ConnectionManager Class Reference

#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
 

Detailed Description

Definition at line 14 of file ConnectionManager.h.

Constructor & Destructor Documentation

ConnectionManager::ConnectionManager ( )

Definition at line 9 of file ConnectionManager.cc.

9  : env(0), conn(0) {
10 }
oracle::occi::Connection * conn
oracle::occi::Environment * env

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 personalPlayback::username.

Referenced by Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea::__init__(), Vispa.Plugins.ConfigEditor.CodeTableView.CodeTableView::_createItem(), Vispa.Gui.BoxContentDialog.BoxContentDialog::addButton(), Vispa.Gui.ToolBoxContainer.ToolBoxContainer::addWidget(), Vispa.Plugins.Browser.BrowserTab.BrowserTab::setController(), and Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu().

20  {
21  if (env!=0) return true;
22  std::string username,password,database;
23 
24  char s[100];
25  FILE* f=fopen(keyFile.c_str(),"r");
26  s[0]=0; fgets(s,100,f); clean(s); username=s;
27  s[0]=0; fgets(s,100,f); clean(s); password=s;
28  s[0]=0; fgets(s,100,f); clean(s); database=s;
29  fclose(f);
30 
31  // printf("'%s' '%s' '%s'\n",username.c_str(),password.c_str(),database.c_str());
32  try {
33  env = oracle::occi::Environment::createEnvironment (oracle::occi::Environment::DEFAULT);
34  conn = env->createConnection (username, password, database);
35  } catch (...) {
36  return false;
37  }
38  return true;
39 }
oracle::occi::Connection * conn
double f[11][100]
std::vector< T * > clean
Definition: MVATrainer.cc:156
static const std::string keyFile("/nfshome0/hcalsw/.ReadOMDSKey")
oracle::occi::Environment * env
void ConnectionManager::disconnect ( )

Definition at line 44 of file ConnectionManager.cc.

References conn, and env.

Referenced by Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu().

44  {
45  if (env==0) return;
46  env->terminateConnection(conn);
47  oracle::occi::Environment::terminateEnvironment(env);
48  env=0; conn=0;
49 }
oracle::occi::Connection * conn
oracle::occi::Environment * env
oracle::occi::Statement * ConnectionManager::getStatement ( const std::string &  query)

Definition at line 40 of file ConnectionManager.cc.

References conn, and env.

40  {
41  if (env==0) return 0;
42  return conn->createStatement(query);
43 }
oracle::occi::Connection * conn
tuple query
Definition: o2o.py:269
oracle::occi::Environment * env

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