Skip to content

Commit

Permalink
支持事务 ab 压了下
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanglei5 committed Nov 24, 2014
1 parent 2074156 commit 666a8ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/DBPool/db_server.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ function run() {
$this->serv->set( array(
'worker_num'=>$this->worker_num,
'task_worker_num' => $this->task_worker_num,
'task_max_request' => 0,
'dispatch_mode' => 2,
//'daemonize'=>1
));
$this->serv->on('Start', array($this, 'onStart'));
$this->serv->on('ManagerStart', array($this, 'onManagerStart'));
Expand Down
9 changes: 8 additions & 1 deletion src/DBPool/transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@
$sql = "insert into `test` values ({$i},'pool{$i}') ";
$db->exec($sql);
*/
//try{
$db->beginTransaction();
for ($i = 1; $i <= 2; $i++) {
for ($i = 1; $i <= 3; $i++) {
$sql = "insert into `test` values ({$i},'pool{$i}') ";
$db->exec($sql);
}
//$db->commit();
$db->rollBack();
/*
} catch (Exception $e) {
print $e->getMessage();
exit();
}
*/
// $db->release();

?>

0 comments on commit 666a8ce

Please sign in to comment.