是否可以保证在以下Larave代码中$last
和$first
的减号是插入值的确切数量?
$this->tempPage->getConnection()->transaction(function() use($insertables, &$importedCount, $userId){
$first = $this->pageModel->getConnection()->getPdo()->lastInsertId();
$this->pageModel->newQuery()->getQuery()->insert($insertables);
$last = $this->pageModel->getConnection()->getPdo()->lastInsertId();
$importedCount = $last - $first;
});
换句话说,只要执行读取查询,表就会锁定在MySql事务中?