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

d_Transaction Class Reference

#include <d_Transaction.h>

List of all members.

Public Types

enum  statuses {
  AVAIL, BEGUN, COMMITTING, ABORTING,
  CHECKPOINTING
}

Public Methods

 d_Transaction (d_Database *iDb=0)
 d_Transaction (oStorage *iStg)
 ~d_Transaction ()
void begin (d_Database *iDb=0)
void commit ()
void abort ()
void checkpoint ()
d_Boolean is_active () const
int getStatus () const
void flushLocalObjects ()
void createObject (d_Object *iObject)
void loadObject (d_Object *iObj, oObjectId &iOid)
void updateObject (d_Object *iObj)
void reserveObject (d_Object *iObject)
void deleteObject (d_Object *iObj, oObjectId &iOid)
void releaseObject (oObjectId &iOid)
virtual bool isTxAble () const

Static Public Methods

d_Transaction * current ()


Detailed Description

The transaction is a logical operation that executes more operations together.

All database operations must be executed inside an open transaction.

Orient ODBMS's transactions have ACID properties:

Atomicity: a transaction is treated as a unit of operation. Therefore, either all or none of the transaction's actions are completed. Consistency: a transaction must guaranty the consistency of the database. If a failure happens while a transaction is open or is committing the database must be consistent after the failure. Isolation: an executing transaction cannot reveal its results to other concurrent transactions before it commits. Durability: referes to the property of transactions that ensures that once a transaction commits, its results are permanent and cannot be erased from the database.

NESTED TRANSACTIONS: Orient supports nested transactions. A nested transaction is a transaction open inside another transaction. All operations executed being associated to the last open transaction.

Nested transactions are totally separate. Thus an abort to a transaction at a lower level doesn't abort the higher level transaction. An abort to a transaction at a higher level doesn't abort the lower level transaction.

There is no limit to the number of transactions nested.

JUST EDITION: The most of operations are executed only in memory without involving the disk storage optimizing performance with no I/O cost until commit operation.

ENTERPRISE EDITION: The most of operations are executed only on the client side without involving the Dynamic Server optimizing performance with no network traffic and leaving the Dynamic Server free.

LOCATION: d_Transaction.h

USAGE: d_Transaction <variable-name>;

Where:

<variable-name>: Name of variable

EXAMPLES: d_Transaction tx;

tx.begin();

.. ..

tx.commit();

ODMG: Compliant


Member Enumeration Documentation

enum d_Transaction::statuses
 

Enumeration values:
AVAIL 
BEGUN 
COMMITTING 
ABORTING 
CHECKPOINTING 


Constructor & Destructor Documentation

d_Transaction::d_Transaction d_Database   iDb = 0
 

Default constructor.

The constructor doesn't begin the transaction.

Optional parameter makes the transaction persistent for crash recovery.

ODMG : Compliant + Extension

d_Transaction::d_Transaction oStorage   iStg
 

d_Transaction::~d_Transaction  
 

Destructor.

If the transaction is open (begin()), then an abort will occurs.

ODMG : Compliant


Member Function Documentation

void d_Transaction::abort  
 

Aborts the transaction.

All database operations executed inside the transaction are aborted, thus none of that operations take effect. If the transaction is not open, an exception d_Error_TransactionNotOpen is raised.

After an abort the persistent objects created in the transaction are freed and the locks acquired are released. All objects loaded in the transaction could be removed by local cache (see d_Object::pin(), d_Object::unpin()).

After this operation, all d_Ref and d_Ref_Any objects used in the transaction will be invalid.

SEE ALSO: commit(), ~d_Transaction() ODMG : Compliant

void d_Transaction::begin d_Database   iDb = 0
 

Starts the transaction.

All database operations must be executed inside an open transaction, otherwise an exception d_Error_TransactionNotOpen is raised.

If the transaction is already open, than an exception d_Error_TransactionOpen is raised.

SEE ALSO: commit(), abort() ODMG : Compliant + Extension

void d_Transaction::checkpoint  
 

Commits the persistent objects in the transaction.

All database operations executed inside the transaction are committed to the database permanently.

If the transaction is not open, an exception d_Error_TransactionNotOpen is raised.

If an error occurs while the transaction commits, the transaction will rollback (calling abort()) leaving the database consistent.

After a checkpoint, the persistent objects created in the transaction are usable and the locks acquired are maintained.

After this operation, all d_Ref and d_Ref_Any objects used in the transaction remain valid.

SEE ALSO: commit(), abort() ODMG : Compliant

void d_Transaction::commit  
 

Commits the transaction.

All database operations executed inside the transaction are committed to the database permanently.

If the transaction is not open, an exception d_Error_TransactionNotOpen is raised.

If an error occurs while the transaction commits, the transaction will rollback (calling abort()) leaving the database consistent.

After a commit, the persistent objects created in the transaction are freed and the locks acquired are released. All objects loaded in the transaction could be removed by local cache (see d_Object::pin(), d_Object::unpin()).

After this operation, all d_Ref and d_Ref_Any objects used in the transaction will be invalid.

SEE ALSO: checkpoint(), abort() ODMG : Compliant

void d_Transaction::createObject d_Object   iObject
 

d_Transaction * d_Transaction::current   [static]
 

Returns the current active transaction for the current thread.

If the transactions are nested, returns the most nested transaction.

ODMG : Compliant

void d_Transaction::deleteObject d_Object   iObj,
oObjectId &    iOid
 

void d_Transaction::flushLocalObjects  
 

int d_Transaction::getStatus   const [inline]
 

Return status of transaction (see d_Transaction::statuses)

d_Boolean d_Transaction::is_active   const [inline]
 

Returns true if the transaction is currently active (open by begin() method), otherwise false.

ODMG : Compliant

bool d_Transaction::isTxAble   const [inline, virtual]
 

Returns always true since d_Transaction class can handle transaction.

void d_Transaction::loadObject d_Object   iObj,
oObjectId &    iOid
 

void d_Transaction::releaseObject oObjectId &    iOid
 

void d_Transaction::reserveObject d_Object   iObject
 

void d_Transaction::updateObject d_Object   iObj
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 29 17:12:15 2002 for Orient ODBMS Just Edition v. 2.0e by doxygen1.3-rc1