test
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 Member Functions | Private Attributes
ora::DatabaseSession Class Reference

#include <DatabaseSession.h>

Public Member Functions

Handle< ora::DatabaseContaineraddContainer (const std::string &containerName, const std::string &className)
 
void commitTransaction ()
 
Configurationconfiguration ()
 
bool connect (const std::string &connectionString, bool readOnly)
 
bool connect (const std::string &connectionString, const std::string &asRole, bool readOnly)
 
bool connect (boost::shared_ptr< coral::ISessionProxy > &coralSession, const std::string &connectionString, const std::string &schemaName)
 
boost::shared_ptr
< ConnectionPool > & 
connectionPool ()
 
const std::string & connectionString ()
 
Handle< DatabaseContainercontainerHandle (const std::string &name)
 
Handle< DatabaseContainercontainerHandle (int contId)
 
NamedSequencecontainerIdSequence ()
 
const std::map< int, Handle
< DatabaseContainer > > & 
containers ()
 
ContainerUpdateTablecontainerUpdateTable ()
 
void create (const std::string &userSchemaVersion=std::string(""))
 
Handle< DatabaseContainercreateContainer (const std::string &containerName, const Reflex::Type &type)
 
 DatabaseSession ()
 
 DatabaseSession (boost::shared_ptr< ConnectionPool > &connectionPool)
 
void disconnect ()
 
void drop ()
 
void dropContainer (const std::string &name)
 
bool eraseAllNames ()
 
bool eraseObjectName (const std::string &name)
 
bool exists ()
 
Object fetchObjectByName (const std::string &name)
 
boost::shared_ptr< void > fetchTypedObjectByName (const std::string &name, const Reflex::Type &asType)
 
bool getItemId (const std::string &name, OId &destination)
 
bool getNamesForContainer (int containerId, std::vector< std::string > &destination)
 
bool getNamesForObject (int containerId, int itemId, std::vector< std::string > &destination)
 
bool isConnected ()
 
bool isTransactionActive (bool checkIfReadOnly=false)
 
bool listObjectNames (std::vector< std::string > &destination)
 
MappingDatabasemappingDatabase ()
 
void open ()
 
void rollbackTransaction ()
 
IDatabaseSchemaschema ()
 
std::string schemaVersion (bool userSchema)
 
void setAccessPermission (const std::string &principal, bool forWrite)
 
void setObjectName (const std::string &name, int containerId, int itemId)
 
void startTransaction (bool readOnly)
 
SharedSessionstorageAccessSession ()
 
bool testDropPermission ()
 
Handle< DatabaseUtilitySessionutility ()
 
virtual ~DatabaseSession ()
 

Private Member Functions

void clearTransaction ()
 

Private Attributes

Configuration m_configuration
 
boost::shared_ptr< ConnectionPoolm_connectionPool
 
std::string m_connectionString
 
ContainerUpdateTable m_containerUpdateTable
 
std::auto_ptr< NamedSequencem_contIdSequence
 
SharedSession m_dbSession
 
std::auto_ptr< MappingDatabasem_mappingDb
 
SessionMonitoringDatam_monitoring
 
bool m_ownedTransaction = true
 
std::auto_ptr< IDatabaseSchemam_schema
 
std::string m_schemaName
 
std::auto_ptr< TransactionCachem_transactionCache
 

Detailed Description

Definition at line 45 of file DatabaseSession.h.

Constructor & Destructor Documentation

ora::DatabaseSession::DatabaseSession ( )

Definition at line 45 of file DatabaseSession.cc.

References m_connectionPool.

45  :
46  m_connectionPool( new ConnectionPool ),
47  m_dbSession(),
48  m_connectionString( "" ),
49  m_schemaName(""),
50  m_schema(),
52  m_mappingDb(),
56  m_monitoring(0){
57  // for the private connection pool does not make sense to have a real pool...
58  m_connectionPool->configuration().setConnectionTimeOut(0);
59 }
SessionMonitoringData * m_monitoring
std::auto_ptr< TransactionCache > m_transactionCache
SharedSession m_dbSession
Configuration m_configuration
std::auto_ptr< IDatabaseSchema > m_schema
ContainerUpdateTable m_containerUpdateTable
std::string m_connectionString
std::auto_ptr< MappingDatabase > m_mappingDb
std::auto_ptr< NamedSequence > m_contIdSequence
boost::shared_ptr< ConnectionPool > m_connectionPool
ora::DatabaseSession::DatabaseSession ( boost::shared_ptr< ConnectionPool > &  connectionPool)
explicit

Definition at line 61 of file DatabaseSession.cc.

61  :
63  m_dbSession(),
64  m_connectionString( "" ),
65  m_schemaName(""),
66  m_schema(),
68  m_mappingDb(),
72  m_monitoring(0){
73 }
SessionMonitoringData * m_monitoring
std::auto_ptr< TransactionCache > m_transactionCache
boost::shared_ptr< ConnectionPool > & connectionPool()
SharedSession m_dbSession
Configuration m_configuration
std::auto_ptr< IDatabaseSchema > m_schema
ContainerUpdateTable m_containerUpdateTable
std::string m_connectionString
std::auto_ptr< MappingDatabase > m_mappingDb
std::auto_ptr< NamedSequence > m_contIdSequence
boost::shared_ptr< ConnectionPool > m_connectionPool
ora::DatabaseSession::~DatabaseSession ( )
virtual

Definition at line 75 of file DatabaseSession.cc.

75  {
76  disconnect();
77 }

Member Function Documentation

ora::Handle< ora::DatabaseContainer > ora::DatabaseSession::addContainer ( const std::string &  containerName,
const std::string &  className 
)

Definition at line 256 of file DatabaseSession.cc.

257  {
258  int newContId = m_contIdSequence->getNextId( true );
259  m_schema->containerHeaderTable().addContainer( newContId, containerName, className );
260  Handle<DatabaseContainer> container( new DatabaseContainer( newContId, containerName,
261  className, 0, *this ) );
262  m_transactionCache->addContainer( newContId, containerName, container );
263  return container;
264 }
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
std::auto_ptr< NamedSequence > m_contIdSequence
std::string className(const T &t)
Definition: ClassName.h:30
void ora::DatabaseSession::clearTransaction ( )
private

Definition at line 119 of file DatabaseSession.cc.

119  {
120  m_transactionCache.reset();
121  m_mappingDb.reset();
122  m_contIdSequence.reset();
123  m_schema.reset();
125 }
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
ContainerUpdateTable m_containerUpdateTable
std::auto_ptr< MappingDatabase > m_mappingDb
std::auto_ptr< NamedSequence > m_contIdSequence
void ora::DatabaseSession::commitTransaction ( )

Definition at line 160 of file DatabaseSession.cc.

160  {
161  if( m_transactionCache.get() ){
162  m_schema->containerHeaderTable().updateNumberOfObjects( m_containerUpdateTable.table() );
163  m_dbSession.get().transaction().commit();
165  if(m_monitoring) {
167  }
168  }
169 }
SessionMonitoringData * m_monitoring
std::auto_ptr< TransactionCache > m_transactionCache
size_t stopTransaction(bool commit_status=true)
Definition: Monitoring.cc:42
coral::ISessionProxy & get()
const std::map< int, unsigned int > & table()
SharedSession m_dbSession
std::auto_ptr< IDatabaseSchema > m_schema
ContainerUpdateTable m_containerUpdateTable
ora::Configuration & ora::DatabaseSession::configuration ( )

Definition at line 382 of file DatabaseSession.cc.

Referenced by ora::getContainerFromSession().

382  {
383  return m_configuration;
384 }
Configuration m_configuration
bool ora::DatabaseSession::connect ( const std::string &  connectionString,
bool  readOnly 
)

Definition at line 79 of file DatabaseSession.cc.

References ora::Monitoring::get(), ora::Monitoring::isEnabled(), and ora::Monitoring::startSession().

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(), ora::DatabaseUtilitySession::importContainer(), ora::DatabaseUtilitySession::importContainerSchema(), 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().

80  {
81  m_dbSession = m_connectionPool->connect( connectionString, readOnly?coral::ReadOnly:coral::Update );
82  if(m_dbSession.isValid()) {
86  }
87  }
88  return isConnected();
89 }
const std::string & connectionString()
SessionMonitoringData * m_monitoring
SharedSession m_dbSession
static Monitoring & get()
Definition: Monitoring.cc:79
SessionMonitoringData * startSession(const std::string &connectionString)
Definition: Monitoring.cc:128
std::string m_connectionString
static bool isEnabled()
Definition: Monitoring.cc:84
boost::shared_ptr< ConnectionPool > m_connectionPool
bool ora::DatabaseSession::connect ( const std::string &  connectionString,
const std::string &  asRole,
bool  readOnly 
)

Definition at line 91 of file DatabaseSession.cc.

References ora::Monitoring::get(), ora::Monitoring::isEnabled(), and ora::Monitoring::startSession().

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

93  {
94  m_dbSession = m_connectionPool->connect( connectionString, asRole, readOnly?coral::ReadOnly:coral::Update );
95  if(m_dbSession.isValid()) {
99  }
100  }
101  return isConnected();
102 }
const std::string & connectionString()
SessionMonitoringData * m_monitoring
SharedSession m_dbSession
static Monitoring & get()
Definition: Monitoring.cc:79
SessionMonitoringData * startSession(const std::string &connectionString)
Definition: Monitoring.cc:128
std::string m_connectionString
static bool isEnabled()
Definition: Monitoring.cc:84
boost::shared_ptr< ConnectionPool > m_connectionPool
bool ora::DatabaseSession::connect ( boost::shared_ptr< coral::ISessionProxy > &  coralSession,
const std::string &  connectionString,
const std::string &  schemaName 
)

Definition at line 104 of file DatabaseSession.cc.

References ora::Monitoring::get(), ora::Monitoring::isEnabled(), and ora::Monitoring::startSession().

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

106  {
107  m_ownedTransaction = false;
108  m_dbSession = SharedSession( coralSession );
109  if(m_dbSession.isValid()) {
111  m_schemaName = schemaName;
114  }
115  }
116  return isConnected();
117 }
const std::string & connectionString()
SessionMonitoringData * m_monitoring
SharedSession m_dbSession
static Monitoring & get()
Definition: Monitoring.cc:79
SessionMonitoringData * startSession(const std::string &connectionString)
Definition: Monitoring.cc:128
std::string m_connectionString
static bool isEnabled()
Definition: Monitoring.cc:84
boost::shared_ptr< ora::ConnectionPool > & ora::DatabaseSession::connectionPool ( )

Definition at line 390 of file DatabaseSession.cc.

390  {
391  return m_connectionPool;
392 }
boost::shared_ptr< ConnectionPool > m_connectionPool
const std::string & ora::DatabaseSession::connectionString ( )

Definition at line 141 of file DatabaseSession.cc.

141  {
142  return m_connectionString;
143 }
std::string m_connectionString
ora::Handle< ora::DatabaseContainer > ora::DatabaseSession::containerHandle ( const std::string &  name)

Definition at line 283 of file DatabaseSession.cc.

Referenced by ora::getContainerFromSession(), and ora::DatabaseUtilitySession::importContainerSchema().

283  {
284  return m_transactionCache->getContainer( name );
285 }
std::auto_ptr< TransactionCache > m_transactionCache
ora::Handle< ora::DatabaseContainer > ora::DatabaseSession::containerHandle ( int  contId)

Definition at line 287 of file DatabaseSession.cc.

287  {
288  return m_transactionCache->getContainer( contId );
289 }
std::auto_ptr< TransactionCache > m_transactionCache
ora::NamedSequence & ora::DatabaseSession::containerIdSequence ( )

Definition at line 374 of file DatabaseSession.cc.

374  {
375  return *m_contIdSequence;
376 }
std::auto_ptr< NamedSequence > m_contIdSequence
const std::map< int, ora::Handle< ora::DatabaseContainer > > & ora::DatabaseSession::containers ( )

Definition at line 291 of file DatabaseSession.cc.

291  {
292  return m_transactionCache->containers();
293 }
std::auto_ptr< TransactionCache > m_transactionCache
ora::ContainerUpdateTable & ora::DatabaseSession::containerUpdateTable ( )

Definition at line 394 of file DatabaseSession.cc.

394  {
395  return m_containerUpdateTable;
396 }
ContainerUpdateTable m_containerUpdateTable
void ora::DatabaseSession::create ( const std::string &  userSchemaVersion = std::string(""))

Definition at line 200 of file DatabaseSession.cc.

200  {
201  m_schema->create( userSchemaVersion );
202  m_contIdSequence->create();
203  m_mappingDb->setUp();
204  m_transactionCache->setDbExists( true );
205 }
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
std::auto_ptr< MappingDatabase > m_mappingDb
std::auto_ptr< NamedSequence > m_contIdSequence
ora::Handle< ora::DatabaseContainer > ora::DatabaseSession::createContainer ( const std::string &  containerName,
const Reflex::Type &  type 
)

Definition at line 267 of file DatabaseSession.cc.

References ora::DatabaseContainer::create().

Referenced by ora::getContainerFromSession().

268  {
269  // create the container
270  int newContId = m_contIdSequence->getNextId( true );
271  Handle<DatabaseContainer> newCont ( new DatabaseContainer( newContId, containerName, type, *this ) );
272  m_transactionCache->addContainer( newContId, containerName, newCont );
273  newCont->create();
274  return newCont;
275 }
type
Definition: HCALResponse.h:21
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< NamedSequence > m_contIdSequence
void ora::DatabaseSession::disconnect ( void  )

Definition at line 127 of file DatabaseSession.cc.

Referenced by Vispa.Views.LineDecayView.LineDecayView::createLineDecayContainer(), Vispa.Views.PropertyView.BooleanProperty::setChecked(), Vispa.Views.PropertyView.BooleanProperty::setReadOnly(), Vispa.Views.PropertyView.DropDownProperty::setReadOnly(), Vispa.Views.PropertyView.TextEditWithButtonProperty::setReadOnly(), Vispa.Views.PropertyView.IntegerProperty::setValue(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::updateViewMenu().

127  {
128  if( isConnected() && m_ownedTransaction ){
130  }
132  m_dbSession.close();
133  m_connectionString.clear();
135 }
SessionMonitoringData * m_monitoring
SharedSession m_dbSession
std::string m_connectionString
bool isTransactionActive(bool checkIfReadOnly=false)
void ora::DatabaseSession::drop ( )

Definition at line 207 of file DatabaseSession.cc.

References ora::throwException().

207  {
208  if(!testDropPermission()){
209  throwException("Drop permission has been denied for the current user.",
210  "DatabaseSession::drop");
211  }
212  m_schema->drop();
213  m_transactionCache->dropDatabase();
214 }
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
void ora::DatabaseSession::dropContainer ( const std::string &  name)

Definition at line 277 of file DatabaseSession.cc.

References cont, ora::DatabaseContainer::drop(), ora::DatabaseContainer::id(), and mergeVDriftHistosByStation::name.

277  {
279  m_transactionCache->eraseContainer( cont->id(), name );
280  cont->drop();
281 }
std::auto_ptr< TransactionCache > m_transactionCache
int cont
bool ora::DatabaseSession::eraseAllNames ( )

Definition at line 305 of file DatabaseSession.cc.

305  {
306  return m_schema->namingServiceTable().eraseAllNames();
307 }
std::auto_ptr< IDatabaseSchema > m_schema
bool ora::DatabaseSession::eraseObjectName ( const std::string &  name)

Definition at line 301 of file DatabaseSession.cc.

301  {
302  return m_schema->namingServiceTable().eraseObjectName( name );
303 }
std::auto_ptr< IDatabaseSchema > m_schema
bool ora::DatabaseSession::exists ( )

Definition at line 193 of file DatabaseSession.cc.

193  {
194  if(!m_transactionCache->dbExistsLoaded()){
195  m_transactionCache->setDbExists( m_schema->exists() );
196  }
197  return m_transactionCache->dbExists();
198 }
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
ora::Object ora::DatabaseSession::fetchObjectByName ( const std::string &  name)

Definition at line 309 of file DatabaseSession.cc.

References cont, ora::DatabaseContainer::fetchItem(), run_regression::ret, and ora::DatabaseContainer::type().

309  {
311  std::pair<int,int> oid;
312  if( m_schema->namingServiceTable().getObjectByName( name, oid ) ){
314  if( cont ) ret = Object( cont->fetchItem( oid.second ), cont->type() );
315  }
316  return ret;
317 }
Handle< DatabaseContainer > containerHandle(const std::string &name)
const Reflex::Type & type()
std::auto_ptr< IDatabaseSchema > m_schema
void * fetchItem(int itemId)
int cont
boost::shared_ptr< void > ora::DatabaseSession::fetchTypedObjectByName ( const std::string &  name,
const Reflex::Type &  asType 
)

Definition at line 328 of file DatabaseSession.cc.

References cont, ora::DatabaseContainer::fetchItemAsType(), run_regression::ret, and ora::DatabaseContainer::type().

329  {
330  boost::shared_ptr<void> ret = m_transactionCache->getNamedReference( name );
331  if( !ret.get() ){
332  std::pair<int,int> oid;
333  if( m_schema->namingServiceTable().getObjectByName( name, oid ) ){
335  void* ptr = 0;
336  if( cont ) {
337  ptr = cont->fetchItemAsType( oid.second, asType );
338  if( ptr) ret = boost::shared_ptr<void>( ptr, RflxDeleter( cont->type() ) );
339  }
340  }
341  if( ret.get() ) m_transactionCache->setNamedReference( name, ret );
342  }
343  return ret;
344 }
Handle< DatabaseContainer > containerHandle(const std::string &name)
const Reflex::Type & type()
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
int cont
void * fetchItemAsType(int itemId, const Reflex::Type &asType)
bool ora::DatabaseSession::getItemId ( const std::string &  name,
ora::OId destination 
)

Definition at line 319 of file DatabaseSession.cc.

319  {
320  std::pair<int,int> oidData;
321  if( m_schema->namingServiceTable().getObjectByName( name, oidData ) ){
322  destination = OId( oidData.first, oidData.second );
323  return true;
324  }
325  return false;
326 }
std::auto_ptr< IDatabaseSchema > m_schema
bool ora::DatabaseSession::getNamesForContainer ( int  containerId,
std::vector< std::string > &  destination 
)

Definition at line 346 of file DatabaseSession.cc.

347  {
348  return m_schema->namingServiceTable().getNamesForContainer( containerId, destination );
349 }
string destination
std::auto_ptr< IDatabaseSchema > m_schema
bool ora::DatabaseSession::getNamesForObject ( int  containerId,
int  itemId,
std::vector< std::string > &  destination 
)

Definition at line 351 of file DatabaseSession.cc.

353  {
354  return m_schema->namingServiceTable().getNamesForObject( containerId, itemId, destination );
355 }
string destination
std::auto_ptr< IDatabaseSchema > m_schema
bool ora::DatabaseSession::isConnected ( )

Definition at line 137 of file DatabaseSession.cc.

137  {
138  return m_dbSession.isValid();
139 }
SharedSession m_dbSession
bool ora::DatabaseSession::isTransactionActive ( bool  checkIfReadOnly = false)

Definition at line 181 of file DatabaseSession.cc.

References run_regression::ret.

181  {
182  bool ret = false;
183  if( m_dbSession.get().transaction().isActive() ){
184  if( checkIfReadOnly ){
185  if( m_dbSession.get().transaction().isReadOnly() ) ret = true;
186  } else {
187  ret = true;
188  }
189  }
190  return ret;
191 }
coral::ISessionProxy & get()
SharedSession m_dbSession
bool ora::DatabaseSession::listObjectNames ( std::vector< std::string > &  destination)

Definition at line 357 of file DatabaseSession.cc.

357  {
358 
359  return m_schema->namingServiceTable().getAllNames( destination );
360 }
string destination
std::auto_ptr< IDatabaseSchema > m_schema
ora::MappingDatabase & ora::DatabaseSession::mappingDatabase ( )

Definition at line 378 of file DatabaseSession.cc.

Referenced by ora::DatabaseUtilitySession::importContainerSchema().

378  {
379  return *m_mappingDb;
380 }
std::auto_ptr< MappingDatabase > m_mappingDb
void ora::DatabaseSession::open ( )

Definition at line 228 of file DatabaseSession.cc.

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::importConfig(), and ora::DatabaseUtilitySession::importContainerSchema().

228  {
229  if(!m_transactionCache->isLoaded()){
230  std::map<std::string, ContainerHeaderData> containersData;
231  m_schema->containerHeaderTable().getContainerData( containersData );
232  for(std::map<std::string, ContainerHeaderData>::iterator iC = containersData.begin();
233  iC != containersData.end(); ++iC){
234  Handle<DatabaseContainer> container( new DatabaseContainer( iC->second.id, iC->first,
235  iC->second.className,
236  iC->second.numberOfObjects, *this ) );
237  m_transactionCache->addContainer( iC->second.id, iC->first, container );
238  }
239  m_schema->mainTable().getParameters( m_transactionCache->dbParams() );
240  m_transactionCache->setLoaded();
241  }
242 }
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
void ora::DatabaseSession::rollbackTransaction ( )

Definition at line 171 of file DatabaseSession.cc.

171  {
172  if( m_transactionCache.get() ){
173  m_dbSession.get().transaction().rollback();
175  if(m_monitoring) {
177  }
178  }
179 }
SessionMonitoringData * m_monitoring
std::auto_ptr< TransactionCache > m_transactionCache
size_t stopTransaction(bool commit_status=true)
Definition: Monitoring.cc:42
coral::ISessionProxy & get()
SharedSession m_dbSession
ora::IDatabaseSchema & ora::DatabaseSession::schema ( )

Definition at line 370 of file DatabaseSession.cc.

370  {
371  return *m_schema;
372 }
std::auto_ptr< IDatabaseSchema > m_schema
std::string ora::DatabaseSession::schemaVersion ( bool  userSchema)

Definition at line 244 of file DatabaseSession.cc.

References AlCaHLTBitMon_QueryRunRegistry::string, ora::IMainTable::userSchemaVersionParameterName(), BeamSplash_cfg::version, and ora::IMainTable::versionParameterName().

244  {
245  std::map<std::string,std::string>& params = m_transactionCache->dbParams();
246  std::string version("");
248  if(userSchema ) paramName = IMainTable::userSchemaVersionParameterName();
249  std::map<std::string,std::string>::const_iterator iPar = params.find( paramName );
250  if( iPar != params.end() ){
251  version = iPar->second;
252  }
253  return version;
254 }
static std::string versionParameterName()
static std::string userSchemaVersionParameterName()
std::auto_ptr< TransactionCache > m_transactionCache
void ora::DatabaseSession::setAccessPermission ( const std::string &  principal,
bool  forWrite 
)

Definition at line 216 of file DatabaseSession.cc.

217  {
218  m_schema->setAccessPermission( principal, forWrite );
219 }
std::auto_ptr< IDatabaseSchema > m_schema
void ora::DatabaseSession::setObjectName ( const std::string &  name,
int  containerId,
int  itemId 
)

Definition at line 295 of file DatabaseSession.cc.

297  {
298  m_schema->namingServiceTable().setObjectName( name, containerId, itemId );
299 }
std::auto_ptr< IDatabaseSchema > m_schema
void ora::DatabaseSession::startTransaction ( bool  readOnly)

Definition at line 145 of file DatabaseSession.cc.

References ora::IDatabaseSchema::createSchemaHandle(), and ora::MappingRules::sequenceNameForContainerId().

145  {
146  if( !m_transactionCache.get() ){
147  m_dbSession.get().transaction().start( readOnly );
148  coral::ISchema* targetSchema = &m_dbSession.get().nominalSchema();
149  if( !m_schemaName.empty() ) targetSchema = &m_dbSession.get().schema( m_schemaName );
150  m_schema.reset( IDatabaseSchema::createSchemaHandle( *targetSchema ));
151  m_contIdSequence.reset( new NamedSequence( MappingRules::sequenceNameForContainerId(), *m_schema ));
152  m_mappingDb.reset( new MappingDatabase( *m_schema ));
153  m_transactionCache.reset( new TransactionCache );
154  if(m_monitoring) {
156  }
157  }
158 }
SessionMonitoringData * m_monitoring
std::auto_ptr< TransactionCache > m_transactionCache
coral::ISessionProxy & get()
SharedSession m_dbSession
std::auto_ptr< IDatabaseSchema > m_schema
static IDatabaseSchema * createSchemaHandle(coral::ISchema &schema)
std::auto_ptr< MappingDatabase > m_mappingDb
std::auto_ptr< NamedSequence > m_contIdSequence
static std::string sequenceNameForContainerId()
sequence names
Definition: MappingRules.cc:9
ora::SharedSession & ora::DatabaseSession::storageAccessSession ( )

Definition at line 386 of file DatabaseSession.cc.

386  {
387  return m_dbSession;
388 }
SharedSession m_dbSession
bool ora::DatabaseSession::testDropPermission ( )

Definition at line 221 of file DatabaseSession.cc.

221  {
222  if(!m_transactionCache->dropPermissionLoaded()){
223  m_transactionCache->setDropPermission( m_schema->testDropPermission() );
224  }
225  return m_transactionCache->dropPermission();
226 }
std::auto_ptr< TransactionCache > m_transactionCache
std::auto_ptr< IDatabaseSchema > m_schema
ora::Handle< ora::DatabaseUtilitySession > ora::DatabaseSession::utility ( )

Definition at line 362 of file DatabaseSession.cc.

362  {
363  if( !m_transactionCache->utility() ){
364  Handle<DatabaseUtilitySession> util ( new DatabaseUtilitySession( *this ) );
365  m_transactionCache->setUtility( util );
366  }
367  return m_transactionCache->utility();
368 }
std::auto_ptr< TransactionCache > m_transactionCache

Member Data Documentation

Configuration ora::DatabaseSession::m_configuration
private

Definition at line 147 of file DatabaseSession.h.

boost::shared_ptr<ConnectionPool> ora::DatabaseSession::m_connectionPool
private

Definition at line 137 of file DatabaseSession.h.

Referenced by DatabaseSession().

std::string ora::DatabaseSession::m_connectionString
private

Definition at line 140 of file DatabaseSession.h.

ContainerUpdateTable ora::DatabaseSession::m_containerUpdateTable
private

Definition at line 146 of file DatabaseSession.h.

std::auto_ptr<NamedSequence> ora::DatabaseSession::m_contIdSequence
private

Definition at line 143 of file DatabaseSession.h.

SharedSession ora::DatabaseSession::m_dbSession
private

Definition at line 138 of file DatabaseSession.h.

std::auto_ptr<MappingDatabase> ora::DatabaseSession::m_mappingDb
private

Definition at line 144 of file DatabaseSession.h.

SessionMonitoringData* ora::DatabaseSession::m_monitoring
private

Definition at line 148 of file DatabaseSession.h.

bool ora::DatabaseSession::m_ownedTransaction = true
private

Definition at line 139 of file DatabaseSession.h.

std::auto_ptr<IDatabaseSchema> ora::DatabaseSession::m_schema
private

Definition at line 142 of file DatabaseSession.h.

std::string ora::DatabaseSession::m_schemaName
private

Definition at line 141 of file DatabaseSession.h.

std::auto_ptr<TransactionCache> ora::DatabaseSession::m_transactionCache
private

Definition at line 145 of file DatabaseSession.h.