# 如何执行事务 参考例子 首先先通过coroutineBegin获取到id。 然后在使用的到事务的coroutineSend方法中第一个参数填写此id。 最后记得执行coroutineCommit或者coroutineRollback。 ```php $transaction_id = yield $this->mysql_pool->coroutineBegin($this); $update_result = yield $this->mysql_pool->dbQueryBuilder->update('user_info') ->set('sex', '1') ->where('uid', 10000) ->coroutineSend($transaction_id); $result = yield $this->mysql_pool->dbQueryBuilder->select('*') ->from('user_info') ->where('uid', 10000) ->coroutineSend($transaction_id); if ($result['result'][0]['channel'] == 1000) { $this->http_output->end('commit'); yield $this->mysql_pool->coroutineCommit($transaction_id); } else { $this->http_output->end('rollback'); yield $this->mysql_pool->coroutineRollback($transaction_id); ```