00001 #include "CondCore/ORA/interface/ScopedTransaction.h" 00002 #include "CondCore/ORA/interface/Transaction.h" 00003 00004 ora::ScopedTransaction::ScopedTransaction( Transaction& dbTransaction ): 00005 m_dbTransaction( dbTransaction ){ 00006 } 00007 00008 ora::ScopedTransaction::ScopedTransaction( const ScopedTransaction& trans ): 00009 m_dbTransaction( trans.m_dbTransaction ){ 00010 } 00011 00012 ora::ScopedTransaction::~ScopedTransaction() { 00013 if( m_dbTransaction.isActive() ) { 00014 rollback(); 00015 } 00016 } 00017 00018 bool ora::ScopedTransaction::start( bool readOnly ){ 00019 return m_dbTransaction.start( readOnly ); 00020 } 00021 00022 bool ora::ScopedTransaction::commit(){ 00023 return m_dbTransaction.commit( ); 00024 } 00025 00026 bool ora::ScopedTransaction::rollback(){ 00027 return m_dbTransaction.rollback( ); 00028 } 00029 00030 bool ora::ScopedTransaction::isActive( bool checkIfReadOnly ) const { 00031 return m_dbTransaction.isActive( checkIfReadOnly ); 00032 } 00033