CodeFoodPixels / node-promise-mysql

A wrapper for mysqljs/mysql that wraps function calls with Bluebird promises.
MIT License
338 stars 63 forks source link

Getting insertId always zero (0) #61

Closed shaishab closed 7 years ago

shaishab commented 7 years ago

After insert new row getting insertId always zero

var customer = yield pool.query(queryTtext, queryValues); then console.log(customer) and getting { "fieldCount": 0, "affectedRows": 1, "insertId": 0, "serverStatus": 2, "warningCount": 0, "message": "", "protocol41": true, "changedRows": 0 }

CodeFoodPixels commented 7 years ago

Does your table have an auto-incremented primary key?

Promise-mysql shouldn't have any effect on this because the return data isn't changed from what mysqljs provides

shaishab commented 7 years ago

not auto incremented but generated from server side

CodeFoodPixels commented 7 years ago

In which case it won't be returned because mysql has no idea what you're using as an ID.

This is not an issue with this library, mysqljs or mysqljs itself, it's intended behaviour.