//*-- Author : Valeriy Onuchin 11/09/2000 
//
//
////////////////////////////////////////////////////////////////////////////////
//
// rooTrans corresponds to ooTrans class
//
// The non-persistence-capable class rooTrans represents a transaction object, 
// which you can use to start and terminate a series of transactions against 
// an Objectivity/DB federated database.

#include "rooObjy.h"
#include <oo.h>

ClassImp(rooTrans)

rooTrans* gooTopTrans;  // current transaction

////////////////////////////////////////////////////////////////////////////////
//______________________________________________________________________________
 rooTrans::rooTrans()
{
   // ctor
   
   ((ooTrans*)fImp) = new ooTrans();
   gooTopTrans = this;
}

//______________________________________________________________________________
 rooTrans::~rooTrans()
{
   // dtor.
   
   // delete ((ooTrans*)fImp);
}

//______________________________________________________________________________
 Bool_t rooTrans::start(Int_t mode,Int_t waitOption,Int_t indexMode)
{
   // Parameters:
   //    mode - concurrent access policy for the newly started transaction. 
   //          Objectivity/DB uses this policy to determine whether the locks 
   //          requested or held by this transaction are compatible with those 
   //          of other transactions:
   //
   //          o  Specify kooNoMROW (the default) to enable the exclusive 
   //             concurrent access policy. This policy allows multiple 
   //             transactions to lock the same container for read, but 
   //             prevents concurrent read and upgrade locks on a container.
   //
   //          o  Specify kooMROW to enable the multiple readers, one writer 
   //             (MROW) concurrent access policy. This policy allows multiple 
   //             transactions to lock the same container for read while one 
   //             transaction locks it for update.
   //
   //    waitOption - lock-waiting behavior for the newly started transaction:
   //
   //          o  Specify kooTransNoWait (the default) to use the default 
   //             lock-waiting option currently in effect for the Objectivity 
   //             context.
   //
   //          o  Specify kooNoWait or 0 to turn off lock waiting for the 
   //             transaction.
   //
   //          o  Specify kooWait to cause the transaction to wait indefinitely
   //             for locks.
   //
   //          o  Specify a timeout period of n seconds for the transaction, 
   //             where n is an integer in the range 1 <= n<= 14400. If n is 
   //             less than 0 or greater than 14400, it is treated as kooWait.
   //
   //          Lock waiting does not apply to MROW read transactions. 
   //          Therefore, any waitOption value you specify is ignored when you
   //          set the openMode parameter to kooMROW.
   //
   //    indexMode -   policy for updating indexes after creating or modifying 
   //          objects with indexed fields:
   //
   //          o  Specify kooInsensitive (the default) to update all applicable
   //             indexes automatically when the transaction commits.
   //
   //          o  Specify kooSensitive to update all applicable indexes 
   //             immediately after an indexed field is created or modified. 
   //             You should use this value for a transaction that modifies 
   //             indexed fields and then performs predicate scans on the 
   //             relevant indexes.
   //          o  Specify kooExplicitUpdate to update all applicable indexes 
   //             only by explicit calls to the rooUpdateIndexes global function.
   
   return ((ooTrans*)fImp)->start((ooMode)mode,(int32)waitOption,(ooIndexMode)indexMode);
}

//______________________________________________________________________________
 Bool_t rooTrans::abort(Int_t mode)
{
   // Terminates the currently active transaction on this transaction object, 
   // and aborts (does not apply) changes to the federated database.
   //
   // Parameter mode - determines what happens to the transaction's open 
   // object references and handles after the transaction is aborted:
   //
   //  - Omit this parameter (or specify kooHandleToNull) to convert the
   //    pointers in open object references and handles to null.
   //
   //  - Specify kooHandleToOID to convert the pointers to object identifiers
   //    (OIDs). Some of these OIDs might be invalid after the aborted 
   //    transaction, however, so your application should avoid reusing these 
   //    invalid OIDs.
   
   return ((ooTrans*)fImp)->abort((ooHandleMode)mode);
}

//______________________________________________________________________________
 Bool_t rooTrans::commit()
{
   // Terminates the currently active transaction on this transaction object, 
   // and commits all changes to the database.
   
   return ((ooTrans*)fImp)->commit();
}

//______________________________________________________________________________
 Bool_t rooTrans::commitAndHold(Int_t mode)
{
   // Parameter mode - mode in which update locks are to be treated:
   //
   //    -  Omit this parameter (or specify oocNoDowngrade) to preserve all 
   //       locks held by the transaction as is.
   //    -  Specify oocDowngradeAll to change all locks to read locks 
   //       (MROW read if the transaction is an MROW transaction, and normal 
   //       read locks otherwise). 
   //
   // Checkpointing a transaction terminates it, commits all changes to the 
   // database, and implicitly starts a new transaction. By default, all locks 
   // acquired during the transaction are preserved as is.

   return ((ooTrans*)fImp)->commitAndHold((ooDowngradeMode)mode);
}

//______________________________________________________________________________
 Bool_t rooTrans::upgrade()
{
   // Identifies the application containing this transaction object as a 
   // special-purpose upgrade application for converting objects after schema 
   // evolution.
   //
   // You must call this member function before starting the first (and only) 
   // transaction in an upgrade application. This transaction must be an update
   // transaction (that is, the transaction must open the federated database 
   // for update) and it must also call the rooFDObj::upgradeObjects member 
   // function to initiate the upgrade process.
   //
   // Object conversion is the process of making existing persistent objects 
   // consistent with class definition changes introduced by schema evolution.
   // Certain schema evolution operations affect how instances of a class should
   // be laid out in storage.
   //
   // After you perform such operations, existing objects of the changed classes
   // are rendered out-of-date until they are converted to their new 
   // representations. In general, affected objects are converted automatically 
   // when they are accessed after schema evolution. However, some schema 
   // changes require that you convert objects explicitly using an upgrade 
   // application to ensure referential integrity.
   
   return ((ooTrans*)fImp)->upgrade();
}

//______________________________________________________________________________
 Bool_t rooTrans::isActive()
{
   // Returns kTRUE if this transaction object is active; otherwise kFALSE.
   
   return ((ooTrans*)fImp)->isActive();
}

//______________________________________________________________________________
 void rooTrans::begin()
{
   // This member function calls start with default parameter values.
   
   ((ooTrans*)fImp)->begin();
}

//______________________________________________________________________________
 void rooTrans::checkpoint()
{
   // Checkpointing a transaction terminates it, commits all changes to the 
   // database,and implicitly starts a new transaction.
   
   ((ooTrans*)fImp)->checkpoint();
}



ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.