Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sql): 事务支持 #55

Open
Ghost-chu opened this issue Aug 6, 2022 · 5 comments
Open

feat(sql): 事务支持 #55

Ghost-chu opened this issue Aug 6, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@Ghost-chu
Copy link
Contributor

Ghost-chu commented Aug 6, 2022

功能简述

添加对支持事务的数据库(和数据库引擎)的事务支持。

需求来源

在处理较为复杂的部分数据时,需要保证数据的一致性。

附加内容

有时可能同一个事务下会出现事务嵌套的情况(从代码逻辑来看)。

====== 事务 A 开始 main() ======
... {进行一些A事务的操作} ...


printf("可选:绑定 IP 与 MAC 地址 开始!");
bindIpMac();
====== 事务 B 开始 bindIpMac() ======
... {进行一些B事务的操作} ...
====== 事务 B 结束 bindIpMac() ======
printf("可选:绑定 IP 与 MAC 地址 结束!");

... {进行一些A事务的操作} ...
====== 事务 A 结束 main() ======
@Ghost-chu Ghost-chu added the enhancement New feature or request label Aug 6, 2022
@CarmJos
Copy link
Owner

CarmJos commented Aug 6, 2022

Transactions cannot be nested. This is a consequence of the implicit commit performed for any current transaction when you issue a START TRANSACTION statement or one of its synonyms.

@CarmJos
Copy link
Owner

CarmJos commented Aug 6, 2022

Mysql 是不支持嵌套事务的,开启了一个事务的情况下,再开启一个事务,会隐式的提交上一个事务。所以我们就要在系统架构层面来支持事务的嵌套,常见的做法就是 SAVEPOINT.

@CarmJos
Copy link
Owner

CarmJos commented Aug 6, 2022

@CarmJos CarmJos changed the title 事务支持 feat(sql): 事务支持 Sep 12, 2022
@CarmJos CarmJos self-assigned this Sep 12, 2022
@CarmJos CarmJos moved this to Todo in Carm's works Sep 17, 2022
@huanmeng-qwq
Copy link
Contributor

催更

@CarmJos
Copy link
Owner

CarmJos commented Oct 15, 2022

@huanmeng-qwq 催更

很抱歉,本人困于奔波,暂时没有时间更新该项目。但这几日我会试着进行一次破坏性更新,该更新包含该功能的实现。


另:
我详细的看了您的 SQLibrary 更新,请问您是否愿意贡献一个“SQLMigrator”功能以支持将数据库中已存在的表更新为目标表结构呢?我相信这个功能一定会方便许多开发者!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants