libs/Yii/db/CDbTransaction.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* CDbTransaction class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2011 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* CDbTransaction represents a DB transaction.
*
* It is usually created by calling {@link CDbConnection::beginTransaction}.
*
* The following code is a common scenario of using transactions:
* <pre>
* $transaction=$connection->beginTransaction();
* try
* {
* $connection->createCommand($sql1)->execute();
* $connection->createCommand($sql2)->execute();
* //.... other SQL executions
* $transaction->commit();
* }
* catch(Exception $e)
* {
* $transaction->rollback();
* }
* </pre>
*
* @property CDbConnection $connection The DB connection for this transaction.
* @property boolean $active Whether this transaction is active.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Id$
* @package system.db
* @since 1.0
*/
class CDbTransaction extends CComponent
{
private $_connection=null;
private $_active;
/**
* Constructor.
* @param CDbConnection $connection the connection associated with this transaction
* @see CDbConnection::beginTransaction
*/
public function __construct(CDbConnection $connection)
{
$this->_connection=$connection;
$this->_active=true;
}
/**
* Commits a transaction.
* @throws CException if the transaction or the DB connection is not active.
*/
public function commit()
后面还有 51 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
