Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TDbTransaction

TComponent
   |
   --TDbTransaction

TDbTransaction class.

TDbTransaction represents a DB transaction. It is usually created by calling TDbConnection::beginTransaction.

The following code is a common scenario of using transactions:

  1. try
  2. {
  3. $transaction=$connection->beginTransaction();
  4. $connection->createCommand($sql1)->execute();
  5. $connection->createCommand($sql2)->execute();
  6. //.... other SQL executions
  7. $transaction->commit();
  8. }
  9. catch(Exception $e)
  10. {
  11. $transaction->rollBack();
  12. }

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Constructor Summary
public
__construct Array
Constructor.

Method Summary
void
commit ()
Commits a transaction.
boolean
TDbConnection
void
Rolls back a transaction.
protected  void
setActive ( boolean $value)
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Constructor Details

__construct

public __construct Array

Constructor.

See: TDbConnection::beginTransaction

Method Details

commit

public void commit ()

Commits a transaction.

Output
Exception
throwsTDbException if the transaction or the DB connection is not active.

getActive

public boolean getActive ()

Output
boolean whether this transaction is active
Exception

getConnection

public TDbConnection getConnection ()

Output
TDbConnection the DB connection for this transaction
Exception

rollback

public void rollback ()

Rolls back a transaction.

Output
Exception
throwsTDbException if the transaction or the DB connection is not active.

setActive

protected void setActive (boolean $value )

Input
boolean$valuewhether this transaction is active
Output
Exception