Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

Transaction Class Reference

#include <tntdb/transaction.h>

Inheritance diagram for Transaction:

List of all members.

Public Member Functions

 Transaction (const Connection &db_, bool starttransaction=true)
 ~Transaction ()
const ConnectiongetConnection () const
void begin ()
void commit ()
void rollback ()


Detailed Description

The class Transaction monitors the state of a transaction on a database-conection.

The constructor starts by default a transaction on the database. The transactionstate is hold it the class. The destructor rolls the transaction back, when not explicitely commited or rolled back.


Constructor & Destructor Documentation

Transaction ( const Connection db_,
bool  starttransaction = true 
)

Start a transaction when instructed.

References Transaction::begin().

~Transaction (  ) 

roll back transaction when still active

References Transaction::rollback().


Member Function Documentation

void begin (  ) 

Starts a new transaction. If there is a active transaction, it is rolled back first

References Connection::beginTransaction(), and Transaction::rollback().

Referenced by Transaction::Transaction().

void commit (  ) 

commits the current transaction. If there is no active transaction, then nothing is done. The transactionstate is reset.

References Connection::commitTransaction().

void rollback (  ) 

rolls back the current transaction. If there is no active transaction, then nothing is done. The transactionstate is reset.

References Connection::rollbackTransaction().

Referenced by Transaction::begin(), and Transaction::~Transaction().

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6