node-querybuilder icon indicating copy to clipboard operation
node-querybuilder copied to clipboard

error in batch_update | Cannot read property 'reset_query' of undefined

Open niranjan02 opened this issue 4 years ago • 1 comments

I was using batch_update but facing this error. The query I am getting in next_batch is working fine still I am getting this.

batch_data [ { column1: 'test', coolumn2: '2.0.2444', id: 12 }, { column1: 'test', coolumn2: '2.0.24444', id: 13 } ]

qb.update_batch(table_name, batch_data, key, where_object, (err, res) => { if (err) { reject(err); } resolve(res); });

TypeError: Cannot read property 'reset_query' of undefined
    at next_batch (C:\Project\node_modules\node-querybuilder\drivers\mysql\query_exec.js:178:22)
    at handler (C:\Project\node_modules\node-querybuilder\drivers\mysql\query_exec.js:205:15)
    at new Promise (<anonymous>)
    at Single.update_batch (C:\Project\node_modules\node-querybuilder\drivers\mysql\query_exec.js:209:20)
    at C:\Project\dao\mysql_helper.js:125:8
    at C:\Project\node_modules\node-querybuilder\drivers\mysql\adapters\pool.js:54:65
    at DatastoreShim.applySegment (C:\Project\node_modules\newrelic\lib\shim\shim.js:1430:20)
    at wrapper (C:\Project\node_modules\newrelic\lib\shim\shim.js:2092:17)
    at Ping.onOperationComplete (C:\Project\node_modules\mysql\lib\Pool.js:110:5)0|communications_micro_service_index  |     at Ping.<anonymous> (C:\managecommunicationsmicroservice\node_modules\mysql\lib\Connection.js:526:10)

niranjan02 avatar Aug 13 '20 07:08 niranjan02

Inside handler function this object scope is not available. In node_modules\node-querybuilder\drivers\mysql\query_exec.js change the lines as per the below image. unknown (3)

jijojayaprakash avatar Jun 29 '22 11:06 jijojayaprakash