forked from martintajur/node-mysql-activerecord
-
Notifications
You must be signed in to change notification settings - Fork 19
Closed
Description
whenever we pass where condition in .update_batch(table,dataset,index[,where],callback), it throws following error
[ { 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 'WHERE `id` = 30 AND `tripId` IN (30,30)' at line 1
at Query.Sequence._packetToError (/home/mohd/app/express-test/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
at Query.ErrorPacket (/home/mohd/app/express-test/node_modules/mysql/lib/protocol/sequences/Query.js:77:18)
at Protocol._parsePacket (/home/mohd/app/express-test/node_modules/mysql/lib/protocol/Protocol.js:279:23)
at Parser.write (/home/mohd/app/express-test/node_modules/mysql/lib/protocol/Parser.js:76:12)
at Protocol.write (/home/mohd/app/express-test/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/home/mohd/app/express-test/node_modules/mysql/lib/Connection.js:103:28)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
--------------------
at Protocol._enqueue (/home/mohd/app/express-test/node_modules/mysql/lib/protocol/Protocol.js:145:48)
at Connection.query (/home/mohd/app/express-test/node_modules/mysql/lib/Connection.js:208:25)
at exec (/home/mohd/app/express-test/node_modules/node-querybuilder/drivers/mysql/query_exec.js:11:18)
at next_batch (/home/mohd/app/express-test/node_modules/node-querybuilder/drivers/mysql/query_exec.js:151:17)
at Object.update_batch (/home/mohd/app/express-test/node_modules/node-querybuilder/drivers/mysql/query_exec.js:169:15)
at Object.<anonymous> (/home/mohd/app/express-test/b.js:26:17)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: '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 \'WHERE `id` = 30 AND `tripId` IN (30,30)\' at line 1',
sqlState: '42000',
index: 0,
sql: 'UPDATE (`trip_students_booking`) SET `studentId` = CASE WHEN `tripId` = 30 THEN 43 WHEN `tripId` = 30 THEN 42 ELSE `studentId` END WHERE WHERE `id` = 30 AND `tripId` IN (30,30)' } ]
We can see that 2 times added where clause