CMS 3D CMS Logo

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.

References keyFile(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Referenced by Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea::__init__(), Vispa.Views.PropertyView.BooleanProperty::__init__(), Vispa.Gui.FindDialog.FindDialog::_addScript(), Vispa.Gui.FindDialog.FindDialog::_addStringProperty(), Vispa.Main.Application.Application::_connectSignals(), Vispa.Plugins.ConfigEditor.CodeTableView.CodeTableView::_createItem(), Vispa.Gui.BoxContentDialog.BoxContentDialog::addButton(), Vispa.Gui.ToolBoxContainer.ToolBoxContainer::addWidget(), Vispa.Views.PropertyView.PropertyView::append(), Vispa.Views.PropertyView.PropertyView::appendAddRow(), Vispa.Main.Application.Application::createAction(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createButton(), Vispa.Views.LineDecayView.LineDecayView::createLineDecayContainer(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createLineEdit(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createTextEdit(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filterDialog(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), HcalAssistant::getListOfChannelsFromDb(), Vispa.Gui.PortWidget.PortWidget::mouseMoveEvent(), Vispa.Views.PropertyView.BooleanProperty::setChecked(), Vispa.Main.SplitterTab.SplitterTab::setController(), Vispa.Plugins.Browser.BrowserTab.BrowserTab::setController(), Vispa.Views.PropertyView.BooleanProperty::setReadOnly(), Vispa.Views.PropertyView.DropDownProperty::setReadOnly(), Vispa.Views.PropertyView.TextEditWithButtonProperty::setReadOnly(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setTab(), Vispa.Views.PropertyView.IntegerProperty::setValue(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView(), o2o_db_cfgmap.DbManagerDAQ::update_hashmap(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::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
static void clean(char *s)
double f[11][100]
static const std::string keyFile("/nfshome0/hcalsw/.ReadOMDSKey")
oracle::occi::Environment * env
void ConnectionManager::disconnect ( )
oracle::occi::Statement * ConnectionManager::getStatement ( const std::string &  query)

Definition at line 40 of file ConnectionManager.cc.

References conn, and env.

Referenced by HcalAssistant::getListOfChannelsFromDb().

40  {
41  if (env==0) return 0;
42  return conn->createStatement(query);
43 }
oracle::occi::Connection * conn
Definition: query.py:1
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().