I'm trying to make a multiple rows update. It works perfectly with 1 row, but with multiple having error sintax. The configuration hsa been set correctly { ..., multipleStatements: true }
But im doing this kind of query, generated from a mapping of list items.
const query = 'UPDATE `ROW_INFO` SET `JSON` = ? WHERE `ID` = ?;UPDATE `ROW_INFO` SET `JSON` = ? WHERE `ID` = ?;'
const values = [ [ {foo:'bar1'}, 1 ], [ {foo:'bar2'}, 2 ] ]
await connection.execute(query, values)
I tried all as 1 array, wrapping in array, in 2 arrays, but nothing, having same error:
ER_PARSE_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 `ROW_INFO` SET `JSON` = `[object Object]` WHERE `ID` = 1' at line 1
If i try to set values on string get worst errors, beacuse json can not be set on query for this case. Hope someone can help me with this kind of error, or how to set the right way the values.