cakephp数据库事务transactions

原理:获取数据库资源句柄 -》curd 操作-》使用 rallback或者submit 提交或者回滚即可

例子:

$dataSource = $this->getDataSource();

 

$dataSource->begin();

// Perform some tasks

if (/*all's well*/) {
    $dataSource->commit();
} else {
    $dataSource->rollback();
}

 

posted @ 2013-04-28 15:11  linksgo2011  阅读(223)  评论(0编辑  收藏  举报