yii 在使用事务时请注意。
$command = Yii::app()->db->createCommand($sql);
$command ->execute();$command->getPdoStatement()->closeCursor();
$transaction->commit();
$command->getPdoStatement()->closeCursor(); 这句很关键,如果没有这句,事务提交就会报错
General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute