<small id='jYWHA'></small><noframes id='jYWHA'>

  1. <i id='jYWHA'><tr id='jYWHA'><dt id='jYWHA'><q id='jYWHA'><span id='jYWHA'><b id='jYWHA'><form id='jYWHA'><ins id='jYWHA'></ins><ul id='jYWHA'></ul><sub id='jYWHA'></sub></form><legend id='jYWHA'></legend><bdo id='jYWHA'><pre id='jYWHA'><center id='jYWHA'></center></pre></bdo></b><th id='jYWHA'></th></span></q></dt></tr></i><div id='jYWHA'><tfoot id='jYWHA'></tfoot><dl id='jYWHA'><fieldset id='jYWHA'></fieldset></dl></div>

      <bdo id='jYWHA'></bdo><ul id='jYWHA'></ul>
    <legend id='jYWHA'><style id='jYWHA'><dir id='jYWHA'><q id='jYWHA'></q></dir></style></legend>
    <tfoot id='jYWHA'></tfoot>

    1. 如果查询失败,是否需要编写 ROLLBACK?

      Is it necessary to write ROLLBACK if queries fail?(如果查询失败,是否需要编写 ROLLBACK?)
      1. <tfoot id='0ZLcj'></tfoot>
          <i id='0ZLcj'><tr id='0ZLcj'><dt id='0ZLcj'><q id='0ZLcj'><span id='0ZLcj'><b id='0ZLcj'><form id='0ZLcj'><ins id='0ZLcj'></ins><ul id='0ZLcj'></ul><sub id='0ZLcj'></sub></form><legend id='0ZLcj'></legend><bdo id='0ZLcj'><pre id='0ZLcj'><center id='0ZLcj'></center></pre></bdo></b><th id='0ZLcj'></th></span></q></dt></tr></i><div id='0ZLcj'><tfoot id='0ZLcj'></tfoot><dl id='0ZLcj'><fieldset id='0ZLcj'></fieldset></dl></div>

          <small id='0ZLcj'></small><noframes id='0ZLcj'>

            <legend id='0ZLcj'><style id='0ZLcj'><dir id='0ZLcj'><q id='0ZLcj'></q></dir></style></legend>
              <tbody id='0ZLcj'></tbody>

                <bdo id='0ZLcj'></bdo><ul id='0ZLcj'></ul>
              • 本文介绍了如果查询失败,是否需要编写 ROLLBACK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我写

                mysql_query("SET AUTOCOMMIT=0");
                mysql_query("开始交易");

                在我编写所有查询之前.然后检查是否所有这些都是真的,然后写:

                mysql_query("COMMIT");

                但是如果其中一个查询失败,我就通过 COMMIT 查询.那么,如果其中一个查询失败,我真的需要 ROLLBACK 函数吗?因为没有 ROLLBACK 它也可以工作.
                谢谢.

                I write

                mysql_query("SET AUTOCOMMIT=0");
                mysql_query("START TRANSACTION");

                before I write all queries. Then check if all of them are true and then write:

                mysql_query("COMMIT");

                But if one of query fails, I just pass COMMIT query. So do I really need ROLLBACK function if one of the queries fail? Because without ROLLBACK it also works.
                Thanks.

                推荐答案

                我想您是在问是否有必要执行 ROLLBACK,因为没有它,提交仍然不会得到应用.这在技术上是正确的,但这只是因为交易仍然处于打开状态,因为您还没有结束它.任何隐式提交事务(例如,启动一个新事务)的行为都将像您运行 COMMIT 一样,这与您想要的相反

                I think you're asking if executing ROLLBACK is necessary, since without it the commits still don't get applied. That's technically true, but only because the transaction is still open since you haven't ended it. Anything that implicitly commits the transaction (for example, starting a new transaction) will act as though you ran COMMIT, which is the opposite of what you want

                这篇关于如果查询失败,是否需要编写 ROLLBACK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
              • <i id='Qdddp'><tr id='Qdddp'><dt id='Qdddp'><q id='Qdddp'><span id='Qdddp'><b id='Qdddp'><form id='Qdddp'><ins id='Qdddp'></ins><ul id='Qdddp'></ul><sub id='Qdddp'></sub></form><legend id='Qdddp'></legend><bdo id='Qdddp'><pre id='Qdddp'><center id='Qdddp'></center></pre></bdo></b><th id='Qdddp'></th></span></q></dt></tr></i><div id='Qdddp'><tfoot id='Qdddp'></tfoot><dl id='Qdddp'><fieldset id='Qdddp'></fieldset></dl></div>
                • <small id='Qdddp'></small><noframes id='Qdddp'>

                    <tfoot id='Qdddp'></tfoot>
                      <tbody id='Qdddp'></tbody>

                        • <bdo id='Qdddp'></bdo><ul id='Qdddp'></ul>

                          <legend id='Qdddp'><style id='Qdddp'><dir id='Qdddp'><q id='Qdddp'></q></dir></style></legend>