Class CDbTransaction
CDbTransaction represents a DB transaction.
It is usually created by calling CDbConnection::beginTransaction().
The following code is a common scenario of using transactions:
$transaction=$connection->beginTransaction();
try
{
$connection->createCommand($sql1)->execute();
$connection->createCommand($sql2)->execute();
//.... other SQL executions
$transaction->commit();
}
catch(Exception $e)
{
$transaction->rollback();
}
- CComponent
-
CDbTransaction
Package: system\db
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/db/CDbTransaction.php
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/db/CDbTransaction.php
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
|
protected
|
public
|
$connection |
#
The DB connection for this transaction. |
public
boolean
|
$active |
#
Whether this transaction is active. |