transaction

We create transaction object before performing operations;

	bangdb_txn *txn = new bangdb_txn();
	
	/*
	//or you can create transaction object on stack like
	bangdb_txn txn;
	*/
	
	//start the transaction, this sets the txn object ready for transaction
	
	db->begin_transaction(txn);
	
	//we use this transaction object in all participating operations
	//transaction object is automatically cleaned up with commit or abort calls
	
	long retval = db->commit_transaction(txn);
	if(retval < 0)
		bangdb_logger("couldn't commit");
		
	//or if we would like to abort then
	db->abort_transaction(txn);
	
	//note that either commit or abort are called, one can't call abort after commit or vise versa
	
	//delete the transaction object if created on heap
	
	delete txn;
	

We get Transaction object through database object;

	Transaction txn = new Transaction();
	db.BeginTransaction(txn);
	
	//we use this transaction object in all participating operations
	//transaction object is automatically cleaned up with commit or abort calls
	
	long retval = db.CommitTransaction(ref txn);
	if(retval < 0)
		Common.BangDBLogger("couldn't commit");
			
	//or if we would like to abort then
	db.AbortTransaction(ref txn);
		
	//note that either commit or abort are called, one can't call abort 
	//after commit or vise versa
	

We create transaction object before performing operations;

	Transaction txn = new Transaction();
	
	//start the transaction
	
	db.beginTransaction(txn);
	
	//we use this transaction object in all participating operations
	//transaction object is automatically cleaned up with commit or abort calls
	
	long retval = db.commitTransaction(ref txn);
	if(retval < 0)
		BangDBCommon.bangdb_logger("couldn't commit");
			
	//or if we would like to abort then
	
	db.abortTransaction(ref txn);
		
	//note that either commit or abort are called, one can't call abort 
	//after commit or vise versa