简体   繁体   English

在START TRANSACTION mysql内的存储过程中进行START TRANSACTION

[英]START TRANSACTION within a stored procedure within a START TRANSACTION mysql

From the mysql docs, it appears ambiguous as to whether calling 从mysql文档来看,关于是否调用

START TRANSACTION;
...
COMMIT;

from within a subroutine will automatically commit the "progress" of the outer caller's TRANSACTION, or whether it will simply add a reference to the outer caller's TRANSACTION, and wait until the final COMMIT in the outer caller (based on this ref-counting scheme) before the changes actually appear in the data tables. 子例程中的内容将自动提交外部调用者的TRANSACTION的“进度”,或者是否将简单地添加对外部调用者的TRANSACTION的引用,并等待直到外部调用者中的最终COMMIT(基于此引用计数方案)在更改实际出现在数据表之前。

Which is correct? 哪个是对的? Perhaps I'm confused from Googling too much, and just hoping for the nested scenario to be reality... 也许我对谷歌搜索太多感到困惑,只是希望嵌套的场景成为现实...

Additional question: If the nested/ref-counted prescription is not "correct", why was it designed this way? 附加问题:如果嵌套/引用计数处方不是“正确”的,为什么要这样设计? Thanks. 谢谢。

SET AUTOCOMMIT=0

then 然后

START TRANSACTION;
...
COMMIT;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM