Skip to content

feature:add xa transaction 增加XA事物支持#27

Merged
PandaLIU-1111 merged 20 commits intodtm-php:masterfrom
YunzhiYike:master
Aug 16, 2022
Merged

feature:add xa transaction 增加XA事物支持#27
PandaLIU-1111 merged 20 commits intodtm-php:masterfrom
YunzhiYike:master

Conversation

@YunzhiYike
Copy link

No description provided.

@YunzhiYike YunzhiYike force-pushed the master branch 3 times, most recently from 85969cd to 18d670c Compare July 18, 2022 15:32
@PandaLIU-1111
Copy link
Member

#16

$this->dbTransaction->xaExec($sql);
} catch (PDOException $exception) {
// Repeat commit/rollback with the same id, report this error, ignore
if (! str_contains($exception->getMessage(), 'XAER_NOTA') && ! str_contains($exception->getMessage(), 'does not exist')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种错误判断在Go里面是可以的,但是在PHP里面,不确定是否可以,最好是实测一下

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个我试过是可以的

$this->dbTransaction->xaExec($sql);
$sql = $this->DBSpecial->getXaSQL('prepare', $xaId);
$this->dbTransaction->xaExec($sql);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里面好像没看到如何处理异常,假如中间出现错误了,这个数据库连接会被断开吗?已执行的sql会被回滚吗?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果出现异常会回滚

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果出现异常会回滚

能否简单介绍一下碰见异常时,相关的异常会在哪个地方处理

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果出现异常会回滚

能否简单介绍一下碰见异常时,相关的异常会在哪个地方处理

这个确实没有加回滚,已经加上去了

@yedf2
Copy link
Contributor

yedf2 commented Aug 16, 2022

这个PR的自动测试貌似没有过,能否看看是因为什么吗?最好是能够过了

@PandaLIU-1111
Copy link
Member

这个PR的自动测试貌似没有过,能否看看是因为什么吗?最好是能够过了

这个我晚点调整一下

@PandaLIU-1111 PandaLIU-1111 merged commit 9e4c853 into dtm-php:master Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants