I'm using mysql2 in my nodejs project, in mysql library i used Multiple Statements for update my database and that works great, but for some reason in mysql2 it doesn't work, i googled it a lot and didn't found any solution, does mysql2 not support in multple statements??
Here's the multiple query
async function updateChannels(dtz) { for (const data of dtz) { multipleQuery += `UPDATE myTable SET data='${data.newData}' WHERE data='${data.oldData}';` } await con.execute(multipleQuery);}
In mysql.createConnection i added multipleStatements: true
- Here's the error
UnhandledPromiseRejectionWarning: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE
That query working great when i copy and paste it in the phpMyAdmin console