在laravel5.3中怎么处理事务嵌套问题
在laravel5.3中怎么处理事务嵌套问题,会报SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT trans2 does not exist,代码如下,一个复杂的系统难免会出现事务嵌套情况
DB::transaction(function(){
$data = [
'url' => "test",
'type' => "test",
'description' => "test",
'content' => "content"
];
DB::table('log')->insert($data);
DB::transaction(function() {
$data = [
'url' => "test",
'type' => "test",
'description' => "test",
'content' => "content"
];
DB::table('log')->insert($data);
});
});
No Comments