CodeFoodPixels / node-promise-mysql

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

connection.query.sql returns undefined #43

Closed xo-chris closed 7 years ago

xo-chris commented 7 years ago

in the mysql docs on npm the example is given:

var post  = {id: 1, title: 'Hello MySQL'};

var query = connection.query('INSERT INTO posts SET ?', post, function (error, results, fields) {

  if (error) throw error;

  // Neat! 
});

console.log(query.sql); // INSERT INTO posts SET `id` = 1, `title` = 'Hello MySQL' 

so query.sql returns the actual sql executed. However when promise-mysql is dropped in then query.sql returns undefined.

can query.sql match the mysql functionality? To know the sql executed is really helpful when troubleshooting

xo-chris commented 7 years ago

ok sorry just saw this is a duplicate. I'll try the work-around debug: ['Com QueryPacket', 'RowDataPacket'] thanks