DBTransaction Class Reference

Class representing a transaction on a database. More...

Inheritance diagram for DBTransaction:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 __call ($name, $args)
 Forwards the five DBI2 methods to the DBI2 object.
 __construct ($parDBI)
 Constructor.
 __destruct ()
 Automatically cancels transaction.
 addCallback ($cb)
 Adds callback to be called when transaction completes.
 cancel ()
 Cancels the transaction.
 commit ()
 Commits the transaction.


Detailed Description

Class representing a transaction on a database.

This class is created by the DBI2::reateTransaction() method. It represent a single, hopefully non-nested transaction. You can call query(), select(), insert(), update() and delete() on it, which function exactly the same as the DBI2 counterparts. When the transaction is finished, call commit() or cancel() to commit or cancel the transaction, respectively. If you do not commit or cancel, the transaction will be automatically cancelled when the transaction object goes out of scope or is to be garbage collected. This prevents locked database connections

Definition at line 355 of file DBI2.php5.


Constructor & Destructor Documentation

DBTransaction::__construct ( parDBI  ) 

Constructor.

For internal use only.

Do not construct transaction objects directly

Parameters:
$parDBI [DBI2]: database connection

Definition at line 366 of file DBI2.php5.

DBTransaction::__destruct (  ) 

Automatically cancels transaction.

For internal use only.

If a transaction isn't explicitly cancelled, this method makes sure that it is when the transaction object goes out of scope.

Definition at line 379 of file DBI2.php5.

References cancel().


Member Function Documentation

DBTransaction::__call ( name,
args 
)

Forwards the five DBI2 methods to the DBI2 object.

This is what allows you to call query(), et al. on this transaction object. Those methods have the same arguments on this object as they do on DBI2.

Parameters:
$name [string]: name of method
$args [array]: arguments to method
Returns:
[mixed]: whatever the DBI2 method returns, or false if an invalid method was called

Definition at line 393 of file DBI2.php5.

References SObject::setError().

DBTransaction::addCallback ( cb  ) 

Adds callback to be called when transaction completes.

See DBI2::addTransactionCallback() for more information

Parameters:
$cb [callback]: callback function

Definition at line 431 of file DBI2.php5.

DBTransaction::cancel (  ) 

Cancels the transaction.

See DBI2::cancelTransaction() for more information

Definition at line 421 of file DBI2.php5.

Referenced by __destruct().

DBTransaction::commit (  ) 

Commits the transaction.

See DBI2::commitTransaction() for more information.

Definition at line 412 of file DBI2.php5.


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:05:51 2010 for Common by  doxygen 1.5.6