Skip to content

Commit

Permalink
修改pgsql兼容,在事务内,没有自增id返回时,因为sql报错,事务中止,不能提交,只能回滚
Browse files Browse the repository at this point in the history
  • Loading branch information
qfz9527 committed Jul 26, 2024
1 parent 0b46d45 commit f119f29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/db/PDOConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,11 @@ public function getLastInsID(BaseQuery $query, string $sequence = null)
try {
$insertId = $this->linkID->lastInsertId($sequence);
} catch (\Exception $e) {
$insertId = '';
if ($this->config['type'] == 'pgsql') {
throw $e;
}else{
$insertId = '';
}
}

return $this->autoInsIDType($query, $insertId);
Expand Down

0 comments on commit f119f29

Please sign in to comment.