kylefarris / node-querybuilder

Node QueryBuilder Adapter for Node.js (tags: nodejs, node, mysql, active record, activerecord, querybuilder, query builder)
49 stars 19 forks source link

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

Open niranjan02 opened 4 years ago

niranjan02 commented 4 years ago

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)
jijojayaprakash commented 2 years ago

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)