What is the difference between mysqli_begin_transaction () and mysqli_autocommit

你。 提交于 2019-12-22 12:27:23

问题


Does mysqli_begin_transaction() achieve the same functionality as mysqli_autocommit () ?


回答1:


  • 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


来源:https://stackoverflow.com/questions/42628661/what-is-the-difference-between-mysqli-begin-transaction-and-mysqli-autocommit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!