CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ora::Database Class Reference

#include <Database.h>

Public Member Functions

Configurationconfiguration ()
 
bool connect (const std::string &connectionString, bool readOnly=false)
 
bool connect (const std::string &connectionString, const std::string &asRole, bool readOnly=false)
 
bool connect (boost::shared_ptr< coral::ISessionProxy > &coralSession, const std::string &connectionString, const std::string &schemaName="")
 
const std::string & connectionString ()
 
Container containerHandle (const std::string &name)
 
Container containerHandle (int contId)
 
std::set< std::string > containers ()
 
bool create (std::string userSchemaVersion=std::string(""))
 
template<typename T >
Container createContainer (const std::string &name)
 
template<typename T >
Container createContainer ()
 
Container createContainer (const std::string &className, std::string name="")
 
template<typename T >
ora::Container createContainer (const std::string &name)
 
template<typename T >
ora::Container createContainer ()
 
 Database ()
 
 Database (const Database &rhs)
 
 Database (boost::shared_ptr< ConnectionPool > &connectionPool)
 
void disconnect ()
 
bool drop ()
 
bool dropContainer (const std::string &name)
 
void erase (const OId &oid)
 
bool eraseAllNames ()
 
bool eraseObjectName (const std::string &name)
 
bool exists ()
 
template<typename T >
boost::shared_ptr< Tfetch (const OId &oid)
 
template<typename T >
boost::shared_ptr< TfetchByName (const std::string &name)
 
Object fetchItem (const OId &oid)
 
Object fetchItemByName (const std::string &name)
 
void flush ()
 
bool getItemId (const std::string &name, OId &destination)
 
bool getNamesForObject (const OId &oid, std::vector< std::string > &destination)
 
template<typename T >
OId insert (const std::string &containerName, const T &data)
 
template<typename T >
OId insert (const T &data)
 
template<typename T >
ora::OId insert (const std::string &containerName, const T &data)
 
template<typename T >
ora::OId insert (const T &data)
 
OId insertItem (const std::string &containerName, const Object &data)
 
bool isConnected ()
 
bool listObjectNames (std::vector< std::string > &destination)
 
bool lockContainer (const std::string &name)
 
Databaseoperator= (const Database &rhs)
 
ora::Version schemaVersion (bool userSchema=false)
 
void setAccessPermission (const std::string &principal, bool forWrite)
 
void setObjectName (const std::string &name, const OId &oid)
 
SharedSessionstorageAccessSession ()
 
Transactiontransaction ()
 
template<typename T >
void update (const OId &oid, const T &data)
 
void updateItem (const OId &oid, const Object &data)
 
DatabaseUtility utility ()
 
virtual ~Database ()
 

Static Public Member Functions

static std::string nameForContainer (const std::type_info &typeInfo)
 
static std::string nameForContainer (const std::string &className)
 

Private Member Functions

void checkTransaction ()
 
Container createContainer (const std::string &name, const std::type_info &typeInfo)
 
Container createContainer (const std::type_info &typeInfo)
 
Container getContainer (const std::string &name, const std::type_info &typeInfo)
 
Container getContainer (const std::type_info &typeInfo)
 
boost::shared_ptr< void > getTypedObjectByName (const std::string &name, const std::type_info &typeInfo)
 
void open (bool writingAccess=false)
 

Private Attributes

boost::shared_ptr< DatabaseImplm_impl
 

Detailed Description

Definition at line 28 of file Database.h.

Constructor & Destructor Documentation

ora::Database::Database ( )

Definition at line 66 of file Database.cc.

Referenced by ProducePlots.ProducePlots::plotAllAndLast40Runs(), PopulateDB.PopulateDB::run(), and DiscoverProcessedRuns.DiscoverProcessedRuns::runsList().

66  :
67  m_impl( new DatabaseImpl ){
68 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
ora::Database::Database ( const Database rhs)

Definition at line 70 of file Database.cc.

Referenced by ProducePlots.ProducePlots::plotAllAndLast40Runs(), PopulateDB.PopulateDB::run(), and DiscoverProcessedRuns.DiscoverProcessedRuns::runsList().

70  :
71  m_impl( rhs.m_impl ){
72 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
ora::Database::Database ( boost::shared_ptr< ConnectionPool > &  connectionPool)

Definition at line 74 of file Database.cc.

Referenced by ProducePlots.ProducePlots::plotAllAndLast40Runs(), PopulateDB.PopulateDB::run(), and DiscoverProcessedRuns.DiscoverProcessedRuns::runsList().

74  :
75  m_impl( new DatabaseImpl( connectionPool) ){
76 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
ora::Database::~Database ( )
virtual

Definition at line 78 of file Database.cc.

78  {
79 }

Member Function Documentation

void ora::Database::checkTransaction ( )
private

Definition at line 124 of file Database.cc.

References ora::throwException().

124  {
125  if(!m_impl->m_session->isConnected()) {
126  throwException("No database storage connected.","Database::checkTransaction");
127  }
128  if(!m_impl->m_transaction->isActive()) {
129  throwException("Transaction is not active.","Database::checkTransaction");
130  }
131 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
ora::Configuration & ora::Database::configuration ( )

Definition at line 86 of file Database.cc.

86  {
87  return m_impl->m_session->configuration();
88 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::connect ( const std::string &  connectionString,
bool  readOnly = false 
)

Definition at line 90 of file Database.cc.

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(), 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(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::updateViewMenu().

91  {
92  return m_impl->m_session->connect( connectionString, readOnly );
93 }
const std::string & connectionString()
Definition: Database.cc:113
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::connect ( const std::string &  connectionString,
const std::string &  asRole,
bool  readOnly = false 
)

Definition at line 95 of file Database.cc.

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(), 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(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::updateViewMenu().

97  {
98  return m_impl->m_session->connect( connectionString, asRole, readOnly );
99 }
const std::string & connectionString()
Definition: Database.cc:113
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::connect ( boost::shared_ptr< coral::ISessionProxy > &  coralSession,
const std::string &  connectionString,
const std::string &  schemaName = "" 
)

Definition at line 101 of file Database.cc.

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(), 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(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::updateViewMenu().

101  {
102  return m_impl->m_session->connect( coralSession, connectionString, schemaName );
103 }
const std::string & connectionString()
Definition: Database.cc:113
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
const std::string & ora::Database::connectionString ( )
ora::Container ora::Database::containerHandle ( const std::string &  name)

Definition at line 275 of file Database.cc.

References generateEDF::cont, and ora::throwException().

Referenced by cond::DbSession::importObject().

275  {
276  open();
277  Handle<DatabaseContainer> cont = m_impl->m_session->containerHandle( name );
278  if( !cont ){
279  throwException("Container \""+name+"\" does not exist in the database.",
280  "Database::containerHandle");
281  }
282  return Container( cont );
283 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
ora::Container ora::Database::containerHandle ( int  contId)

Definition at line 285 of file Database.cc.

References generateEDF::cont, and ora::throwException().

285  {
286  open();
287  Handle<DatabaseContainer> cont = m_impl->m_session->containerHandle( contId );
288  if( !cont ){
289  std::stringstream messg;
290  messg << "Container with id=" << contId << " not found in the database.";
291  throwException(messg.str(),
292  "Database::containerHandle");
293  }
294  return Container( cont );
295 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
std::set< std::string > ora::Database::containers ( )

Definition at line 194 of file Database.cc.

References python.multivaluedict::map().

Referenced by cond::IOVSchemaUtility::createIOVContainer(), cond::IOVSchemaUtility::createPayloadContainer(), cond::IOVSchemaUtility::dropIOVContainer(), cond::IOVSchemaUtility::dropPayloadContainer(), and cond::IOVSchemaUtility::existsIOVContainer().

194  {
195  open();
196  std::set< std::string > contList;
197  const std::map<int, Handle<DatabaseContainer> >& conts = m_impl->m_session->containers();
198  for(std::map<int, Handle<DatabaseContainer> >::const_iterator iC = conts.begin();
199  iC != conts.end(); iC++ ){
200  contList.insert( iC->second->name() );
201  }
202  return contList;
203 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::create ( std::string  userSchemaVersion = std::string(""))

Definition at line 138 of file Database.cc.

Referenced by cond::IOVSchemaUtility::createIOVContainer().

138  {
139  bool created = false;
140  if( !exists()){
141  m_impl->m_session->create( userSchemaVersion );
142  created = true;
143  }
144  return created;
145 }
bool exists()
Definition: Database.cc:133
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
template<typename T >
Container ora::Database::createContainer ( const std::string &  name)
template<typename T >
Container ora::Database::createContainer ( )

Referenced by createContainer().

ora::Container ora::Database::createContainer ( const std::string &  className,
std::string  name = "" 
)

Definition at line 229 of file Database.cc.

References generateEDF::cont, ora::ClassUtils::lookupDictionary(), and ora::throwException().

230  {
231  open( true );
233  if( name.empty() ) name = nameForContainer( className );
234  if( m_impl->m_session->containerHandle( name ) ){
235  throwException("Container with name \""+name+"\" already exists in the database.",
236  "Database::createContainer");
237  }
238  Handle<DatabaseContainer> cont = m_impl->m_session->createContainer( name, contType );
239  return Container( cont );
240 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
static std::string nameForContainer(const std::type_info &typeInfo)
Definition: Database.cc:57
std::string className(const T &t)
Definition: ClassName.h:30
ora::Container ora::Database::createContainer ( const std::string &  name,
const std::type_info &  typeInfo 
)
private

Definition at line 205 of file Database.cc.

References generateEDF::cont, ora::ClassUtils::lookupDictionary(), and ora::throwException().

206  {
207  open( true );
208  if( m_impl->m_session->containerHandle( name ) ){
209  throwException("Container with name \""+name+"\" already exists in the database.",
210  "Database::createContainer");
211  }
212  edm::TypeWithDict contType = ClassUtils::lookupDictionary( typeInfo );
213  Handle<DatabaseContainer> cont = m_impl->m_session->createContainer( name, contType );
214  return Container( cont );
215 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
ora::Container ora::Database::createContainer ( const std::type_info &  typeInfo)
private

Definition at line 217 of file Database.cc.

References generateEDF::cont, ora::ClassUtils::lookupDictionary(), mergeVDriftHistosByStation::name, ora::nameFromClass(), AlCaHLTBitMon_QueryRunRegistry::string, and ora::throwException().

217  {
218  open( true );
219  edm::TypeWithDict contType = ClassUtils::lookupDictionary( typeInfo );
220  std::string name = nameFromClass( contType );
221  if( m_impl->m_session->containerHandle( name ) ){
222  throwException("Container with name \""+name+"\" already exists in the database.",
223  "Database::createContainer");
224  }
225  Handle<DatabaseContainer> cont = m_impl->m_session->createContainer( name, contType );
226  return Container( cont );
227 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
void open(bool writingAccess=false)
Definition: Database.cc:174
std::string nameFromClass(const edm::TypeWithDict &contType)
Definition: Database.cc:37
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
template<typename T >
ora::Container ora::Database::createContainer ( const std::string &  name)
inline

Definition at line 208 of file Database.h.

References createContainer().

208  {
209  return createContainer( name, typeid(T) );
210 }
Container createContainer()
long double T
template<typename T >
ora::Container ora::Database::createContainer ( )
inline

Definition at line 214 of file Database.h.

214  {
215  return createContainer( typeid(T) );
216 }
Container createContainer()
long double T
void ora::Database::disconnect ( void  )
bool ora::Database::drop ( )

Definition at line 147 of file Database.cc.

References python.multivaluedict::map().

Referenced by cond::IOVSchemaUtility::dropAll().

147  {
148  bool dropped = false;
149  if( exists()){
150  open();
151  const std::map<int, Handle<DatabaseContainer> >& conts = m_impl->m_session->containers();
152  for(std::map<int, Handle<DatabaseContainer> >::const_iterator iC = conts.begin();
153  iC != conts.end(); iC++ ){
154  iC->second->drop();
155  }
156  m_impl->m_session->drop();
157  dropped = true;
158  }
159  return dropped;
160 }
void open(bool writingAccess=false)
Definition: Database.cc:174
bool exists()
Definition: Database.cc:133
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::dropContainer ( const std::string &  name)

Definition at line 256 of file Database.cc.

Referenced by cond::IOVSchemaUtility::dropIOVContainer(), and cond::IOVSchemaUtility::dropPayloadContainer().

256  {
257  open();
258  if( !m_impl->m_session->containerHandle( name ) ){
259  return false;
260  }
261  m_impl->m_session->dropContainer( name );
262  return true;
263 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void ora::Database::erase ( const OId oid)

Definition at line 317 of file Database.cc.

References generateEDF::cont, ora::OId::containerId(), ora::Container::erase(), and ora::OId::itemId().

317  {
318  open();
319  Container cont = containerHandle( oid.containerId() );
320  cont.erase( oid.itemId() );
321 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
void open(bool writingAccess=false)
Definition: Database.cc:174
Container containerHandle(const std::string &name)
Definition: Database.cc:275
void erase(int itemId)
Definition: Container.cc:161
bool ora::Database::eraseAllNames ( )

Definition at line 342 of file Database.cc.

342  {
343  open();
344  return m_impl->m_session->eraseAllNames();
345 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::eraseObjectName ( const std::string &  name)

Definition at line 337 of file Database.cc.

337  {
338  open();
339  return m_impl->m_session->eraseObjectName( name );
340 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::exists ( )

Definition at line 133 of file Database.cc.

Referenced by cond::IOVSchemaUtility::createIOVContainer(), cond::persistency::OraIOVSchema::exists(), and cond::IOVSchemaUtility::existsIOVContainer().

133  {
135  return m_impl->m_session->exists();
136 }
void checkTransaction()
Definition: Database.cc:124
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
template<typename T >
boost::shared_ptr< T > ora::Database::fetch ( const OId oid)
inline

Definition at line 220 of file Database.h.

References generateEDF::cont, ora::OId::containerId(), ora::Container::fetch(), and ora::OId::itemId().

Referenced by cond::DbSession::getTypedObject().

220  {
221  Container cont = containerHandle( oid.containerId() );
222  return cont.fetch<T>( oid.itemId() );
223 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
Container containerHandle(const std::string &name)
Definition: Database.cc:275
boost::shared_ptr< T > fetch(int itemId)
Definition: Container.h:129
long double T
template<typename T >
boost::shared_ptr< T > ora::Database::fetchByName ( const std::string &  name)
inline

Definition at line 252 of file Database.h.

252  {
253  return boost::static_pointer_cast<T>( getTypedObjectByName( name, typeid(T) ) );
254 }
boost::shared_ptr< void > getTypedObjectByName(const std::string &name, const std::type_info &typeInfo)
Definition: Database.cc:352
long double T
ora::Object ora::Database::fetchItem ( const OId oid)

Definition at line 297 of file Database.cc.

References generateEDF::cont, ora::OId::containerId(), ora::Container::fetchItem(), and ora::OId::itemId().

297  {
298  Container cont = containerHandle( oid.containerId() );
299  return cont.fetchItem( oid.itemId() );
300 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
Object fetchItem(int itemId)
Definition: Container.cc:109
Container containerHandle(const std::string &name)
Definition: Database.cc:275
ora::Object ora::Database::fetchItemByName ( const std::string &  name)

Definition at line 358 of file Database.cc.

358  {
359  open();
360  return m_impl->m_session->fetchObjectByName( name );
361 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void ora::Database::flush ( )

Definition at line 323 of file Database.cc.

References python.multivaluedict::map().

Referenced by cond::DbSession::storeObject(), and cond::DbSession::updateObject().

323  {
324  open();
325  const std::map<int,Handle<DatabaseContainer> >& containers = m_impl->m_session->containers();
326  for( std::map<int,Handle<DatabaseContainer> >::const_iterator iCont = containers.begin();
327  iCont != containers.end(); ++iCont ){
328  iCont->second->flush();
329  }
330 }
void open(bool writingAccess=false)
Definition: Database.cc:174
std::set< std::string > containers()
Definition: Database.cc:194
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
ora::Container ora::Database::getContainer ( const std::string &  name,
const std::type_info &  typeInfo 
)
private

Definition at line 242 of file Database.cc.

References ora::getContainerFromSession(), and ora::ClassUtils::lookupDictionary().

243  {
244  open( true );
245  edm::TypeWithDict objType = ClassUtils::lookupDictionary( typeInfo );
246  return getContainerFromSession( containerName, objType, *m_impl->m_session );
247 }
void open(bool writingAccess=false)
Definition: Database.cc:174
Container getContainerFromSession(const std::string &name, const edm::TypeWithDict &contType, DatabaseSession &session)
Definition: Database.cc:41
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
ora::Container ora::Database::getContainer ( const std::type_info &  typeInfo)
private

Definition at line 249 of file Database.cc.

References ora::getContainerFromSession(), ora::ClassUtils::lookupDictionary(), ora::nameFromClass(), and AlCaHLTBitMon_QueryRunRegistry::string.

249  {
250  open( true );
251  edm::TypeWithDict objType = ClassUtils::lookupDictionary( typeInfo );
252  std::string contName = nameFromClass( objType );
253  return getContainerFromSession( contName, objType, *m_impl->m_session);
254 }
void open(bool writingAccess=false)
Definition: Database.cc:174
Container getContainerFromSession(const std::string &name, const edm::TypeWithDict &contType, DatabaseSession &session)
Definition: Database.cc:41
std::string nameFromClass(const edm::TypeWithDict &contType)
Definition: Database.cc:37
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
bool ora::Database::getItemId ( const std::string &  name,
ora::OId destination 
)

Definition at line 347 of file Database.cc.

347  {
348  open();
349  return m_impl->m_session->getItemId( name, destination );
350 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::getNamesForObject ( const OId oid,
std::vector< std::string > &  destination 
)

Definition at line 363 of file Database.cc.

References ora::OId::containerId(), roll_playback::destination, ora::OId::itemId(), and ora::throwException().

364  {
366  if( !m_impl->m_session->exists() ){
367  throwException("Database does not exists in \""+m_impl->m_session->connectionString()+"\"","Database::getNamesForObject");
368  }
369  return m_impl->m_session->getNamesForObject( oid.containerId(), oid.itemId(), destination );
370 }
void checkTransaction()
Definition: Database.cc:124
string destination
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
boost::shared_ptr< void > ora::Database::getTypedObjectByName ( const std::string &  name,
const std::type_info &  typeInfo 
)
private

Definition at line 352 of file Database.cc.

References ora::ClassUtils::lookupDictionary().

352  {
353  open();
354  edm::TypeWithDict objType = ClassUtils::lookupDictionary( typeInfo );
355  return m_impl->m_session->fetchTypedObjectByName( name, objType );
356 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
template<typename T >
OId ora::Database::insert ( const std::string &  containerName,
const T data 
)
template<typename T >
OId ora::Database::insert ( const T data)
template<typename T >
ora::OId ora::Database::insert ( const std::string &  containerName,
const T data 
)
inline

Definition at line 227 of file Database.h.

References generateEDF::cont, ora::Container::id(), and ora::Container::insert().

Referenced by BeautifulSoup.PageElement::_invert().

228  {
229  Container cont = getContainer( containerName, typeid(data) );
230  int itemId = cont.insert( data );
231  return OId( cont.id(), itemId );
232 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Container getContainer(const std::string &name, const std::type_info &typeInfo)
Definition: Database.cc:242
template<typename T >
ora::OId ora::Database::insert ( const T data)
inline

Definition at line 236 of file Database.h.

References generateEDF::cont, ora::Container::id(), and ora::Container::insert().

Referenced by BeautifulSoup.PageElement::_invert().

236  {
237  Container cont = getContainer( typeid(data) );
238  int itemId = cont.insert( data );
239  return OId( cont.id(), itemId );
240 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Container getContainer(const std::string &name, const std::type_info &typeInfo)
Definition: Database.cc:242
ora::OId ora::Database::insertItem ( const std::string &  containerName,
const Object data 
)

Definition at line 302 of file Database.cc.

References generateEDF::cont, ora::getContainerFromSession(), ora::Container::id(), ora::Container::insertItem(), and ora::Object::type().

303  {
304  open( true );
305  Container cont = getContainerFromSession( containerName, dataObject.type(), *m_impl->m_session );
306  int itemId = cont.insertItem( dataObject );
307  return OId( cont.id(), itemId );
308 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
int insertItem(const Object &data)
Definition: Container.cc:129
void open(bool writingAccess=false)
Definition: Database.cc:174
Container getContainerFromSession(const std::string &name, const edm::TypeWithDict &contType, DatabaseSession &session)
Definition: Database.cc:41
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::isConnected ( )

Definition at line 109 of file Database.cc.

109  {
110  return m_impl->m_session->isConnected();
111 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
bool ora::Database::listObjectNames ( std::vector< std::string > &  destination)

Definition at line 372 of file Database.cc.

References ora::throwException().

372  {
374  if( !m_impl->m_session->exists() ){
375  throwException("Database does not exists in \""+m_impl->m_session->connectionString()+"\"","Database::listObjectNames");
376  }
377  return m_impl->m_session->listObjectNames( destination );
378 }
void checkTransaction()
Definition: Database.cc:124
string destination
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
bool ora::Database::lockContainer ( const std::string &  name)

Definition at line 265 of file Database.cc.

References generateEDF::cont, ora::DatabaseContainer::lock(), and ora::throwException().

Referenced by cond::ExportIOVUtilities::execute().

265  {
266  open();
267  Handle<DatabaseContainer> cont = m_impl->m_session->containerHandle( name );
268  if( !cont ){
269  throwException("Container \""+name+"\" does not exist in the database.",
270  "Database::lockContainer");
271  }
272  return cont->lock();
273 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
std::string ora::Database::nameForContainer ( const std::type_info &  typeInfo)
static

Definition at line 57 of file Database.cc.

References ora::ClassUtils::lookupDictionary(), and ora::nameFromClass().

57  {
58  edm::TypeWithDict contType = ClassUtils::lookupDictionary( typeInfo );
59  return nameFromClass( contType );
60 }
std::string nameFromClass(const edm::TypeWithDict &contType)
Definition: Database.cc:37
edm::TypeWithDict lookupDictionary(const std::type_info &typeInfo, bool throwFlag=true)
Definition: ClassUtils.cc:167
std::string ora::Database::nameForContainer ( const std::string &  className)
static

Definition at line 62 of file Database.cc.

References className().

62  {
63  return className;
64 }
std::string className(const T &t)
Definition: ClassName.h:30
void ora::Database::open ( bool  writingAccess = false)
private

Definition at line 174 of file Database.cc.

References ora::Configuration::automaticDatabaseCreation(), and ora::throwException().

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::importConfig().

174  {
176  if( !m_impl->m_session->exists() ){
177  if( writingAccess && m_impl->m_session->configuration().properties().getFlag( Configuration::automaticDatabaseCreation() ) ){
178  m_impl->m_session->create();
179  } else {
180  throwException("Database does not exists in \""+m_impl->m_session->connectionString()+"\"","Database::open");
181  }
182  }
183  m_impl->m_session->open();
184 }
void checkTransaction()
Definition: Database.cc:124
static std::string automaticDatabaseCreation()
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
ora::Database & ora::Database::operator= ( const Database rhs)

Definition at line 81 of file Database.cc.

References m_impl.

81  {
82  if( this != &rhs ) m_impl = rhs.m_impl;
83  return *this;
84 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
ora::Version ora::Database::schemaVersion ( bool  userSchema = false)

Definition at line 186 of file Database.cc.

References ora::Version::fromString(), and ora::throwException().

186  {
188  if( !m_impl->m_session->exists() ){
189  throwException("Database does not exists in \""+m_impl->m_session->connectionString()+"\"","Database::schemaVersion");
190  }
191  return Version::fromString( m_impl->m_session->schemaVersion( userSchema ) );
192 }
static Version fromString(const std::string &versionString)
Definition: Version.cc:21
void checkTransaction()
Definition: Database.cc:124
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
void ora::Database::setAccessPermission ( const std::string &  principal,
bool  forWrite 
)

Definition at line 162 of file Database.cc.

References python.multivaluedict::map().

162  {
163  if( exists()){
164  open();
165  m_impl->m_session->setAccessPermission( principal, forWrite );
166  const std::map<int, Handle<DatabaseContainer> >& conts = m_impl->m_session->containers();
167  for(std::map<int, Handle<DatabaseContainer> >::const_iterator iC = conts.begin();
168  iC != conts.end(); iC++ ){
169  iC->second->setAccessPermission( principal, forWrite );
170  }
171  }
172 }
void open(bool writingAccess=false)
Definition: Database.cc:174
bool exists()
Definition: Database.cc:133
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void ora::Database::setObjectName ( const std::string &  name,
const OId oid 
)

Definition at line 332 of file Database.cc.

References ora::OId::containerId(), and ora::OId::itemId().

332  {
333  open( true );
334  m_impl->m_session->setObjectName( name, oid.containerId(), oid.itemId() );
335 }
void open(bool writingAccess=false)
Definition: Database.cc:174
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
ora::SharedSession & ora::Database::storageAccessSession ( )

Definition at line 386 of file Database.cc.

386  {
387  return m_impl->m_session->storageAccessSession();
388 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
ora::Transaction & ora::Database::transaction ( )

Definition at line 117 of file Database.cc.

References ora::throwException().

117  {
118  if(!m_impl->m_session->isConnected()) {
119  throwException("No database storage connected.","Database::transaction");
120  }
121  return *m_impl->m_transaction;
122 }
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
template<typename T >
void ora::Database::update ( const OId oid,
const T data 
)
inline

Definition at line 244 of file Database.h.

References generateEDF::cont, ora::OId::containerId(), data, ora::OId::itemId(), and ora::Container::update().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), python.seqvaluedict.seqdict::__setslice__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.seqvaluedict.seqdict::extend(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), Vispa.Gui.PortConnection.PointToPointConnection::updateConnection(), and cond::DbSession::updateObject().

245  {
246  Container cont = containerHandle( oid.containerId() );
247  cont.update( oid.itemId(), data );
248 }
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
Container containerHandle(const std::string &name)
Definition: Database.cc:275
void update(int itemId, const T &data)
Definition: Container.h:141
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ora::Database::updateItem ( const OId oid,
const Object data 
)

Definition at line 310 of file Database.cc.

References generateEDF::cont, ora::OId::containerId(), ora::OId::itemId(), and ora::Container::updateItem().

311  {
312  open();
313  Container cont = containerHandle( oid.containerId() );
314  cont.updateItem( oid.itemId(), dataObject );
315 }
void updateItem(int itemId, const Object &data)
Definition: Container.cc:144
tuple cont
load Luminosity info ##
Definition: generateEDF.py:622
EcalChannelStatus Container
void open(bool writingAccess=false)
Definition: Database.cc:174
Container containerHandle(const std::string &name)
Definition: Database.cc:275
ora::DatabaseUtility ora::Database::utility ( )

Definition at line 380 of file Database.cc.

380  {
382  Handle<DatabaseUtilitySession> utilSession = m_impl->m_session->utility();
383  return DatabaseUtility( utilSession );
384 }
void checkTransaction()
Definition: Database.cc:124
boost::shared_ptr< DatabaseImpl > m_impl
Definition: Database.h:200

Member Data Documentation

boost::shared_ptr<DatabaseImpl> ora::Database::m_impl
private

Definition at line 200 of file Database.h.

Referenced by operator=().