mysqli_multi_query何时停止执行? [英] When does mysqli_multi_query stop execution?

查看:108
本文介绍了mysqli_multi_query何时停止执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

建议我们使用以下3个MySQL命令编写此SQL文本:

Suggested that we have this SQL text with 3 MySQL commands:

show tables;

some nonesense command which makes error;

show tables;

第一个和第三个SQL有效,第二个无效.因此,当将此SQL文本传递给mysqli_multi_query时,MySQL会在第二个命令(错误一个)停止执行吗,还是试图一直执行到最后一个命令?如果在错误一之后的那些命令依赖于错误一,那么这很危险.

The first and third SQL are valid, the second isn't. So, when passing this SQL text to mysqli_multi_query, does MySQL stop execution at the second command (error one) or it tries to go on until the last command? Coz it is dangerous if those commands after the error one relies on the error one.

推荐答案

否,如果一个查询失败,则其余查询将不执行.请参阅mysqli_multi_query的文档中的此注释. ,这很清楚,也展示了一种检查错误的方法.

No, if one query fails the rest will not be executed. See this comment over at the documentation for mysqli_multi_query, which makes this clear and also showcases one way to check for errors.

这篇关于mysqli_multi_query何时停止执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆