Multi-Statement Query Support in Node-MySQL
In Node.js, the question arises when executing multiple SQL statements in a single query using the node-mysql package.
The code provided by the user attempts to delete records from four tables using半彩色(;)分开语句。但是,这导致错误指出SQL语法中存在错误。
node-mysql文档最初出于安全原因最初禁用多个语句支持,因为它可能导致SQL注入攻击。要启用此功能,您需要在创建连接时将倍增设置设置为true:var connection = mysql.createconnection({{multipleStatement:true});
通过执行一个element and ement element and and e ementai语句。var connection = mysql.createConnection({multipleStatements: true});在您的情况下,通过将乘法设置为true,您的初始代码应在单个查询中成功执行四个删除语句,从而消除了对多个查询的需求并提高代码效率。
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3