Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/CdbBdb/CdbBdbTransaction.cc

Go to the documentation of this file.
00001 /// The implementation of the CdbBdbTransaction.
00002 /**
00003   * @see CdbBdbTransaction
00004   */
00005 
00006 #include "BaBar/BaBar.hh"
00007 
00008 #include "CdbBdb/CdbBdbTransaction.hh"
00009 
00010 #include "BdbCond/BdbConditions.hh"
00011 
00012 CdbBdbTransaction::CdbBdbTransaction( BdbMode theMode )
00013 {
00014     BdbConditions* app = BdbConditions::instance( );
00015     app->activate( );
00016 
00017     _originalMode = app->mode( );    // Record the initial transaction state
00018     app->change( theMode );          // Change to the desired state.
00019 }
00020 
00021 CdbBdbTransaction::~CdbBdbTransaction( )
00022 {
00023     BdbConditions* app = BdbConditions::instance( );
00024     if( app->mode( ) != _originalMode ) {
00025 
00026       // Restore the original status.  If we're in update mode,
00027       // force a commit.
00028 
00029         app->change( _originalMode, app->mode( ) == BdbcUpdate );
00030     }
00031     app->deactivate( );
00032 }
00033 
00034 void
00035 CdbBdbTransaction::commitAndHold( )
00036 {
00037     BdbConditions* app = BdbConditions::instance( );
00038     app->activate( );        // Need this to balance the "deactivate" in the method called below.
00039     app->commitAndHold( );
00040 }
00041 
00042 /////////////////
00043 // End Of File //
00044 /////////////////

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002