mysqli_begin_transaction()和mysqli_autocommit有什么区别 [英] What is the difference between mysqli_begin_transaction () and mysqli_autocommit
本文介绍了mysqli_begin_transaction()和mysqli_autocommit有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mysqli_begin_transaction()
是否实现与mysqli_autocommit ()
相同的功能?
Does mysqli_begin_transaction()
achieve the same functionality as mysqli_autocommit ()
?
推荐答案
-
mysqli_autocommit()
永久设置自动提交模式.这意味着,如果将其设置为0然后提交事务,则该模式将保持为0. -
mysqli_begin_transaction()
开始一个事务.这意味着在提交后,模式将恢复为之前的状态.
此外,它还允许您微调交易,并以下列方式之一启动它:- MYSQLI_TRANS_START_READ_ONLY.
- MYSQLI_TRANS_START_READ_WRITE
- MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT
您可以阅读mysql文档中的模式, https://dev. mysql.com/doc/refman/5.7/en/commit.html mysqli_autocommit()
sets autocommit mode permanently. It means that if you set it to 0 and then commit a transaction, the mode will remain 0.mysqli_begin_transaction()
begins a single transaction. It means after commit the mode reverts to its previous state.
besides, it allows you to fine tune a transaction, starting it in one of the following modes:- MYSQLI_TRANS_START_READ_ONLY.
- MYSQLI_TRANS_START_READ_WRITE
- MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT
You can read on the modes in mysql documentation, https://dev.mysql.com/doc/refman/5.7/en/commit.html
这篇关于mysqli_begin_transaction()和mysqli_autocommit有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文