Skip to content
Advertisement

Nested SQL.promise() callback in Javascript

I want to write a nested callback JavaScript in order to use the subsequent ID’s of the INSERT statements in the different SQL tables. My code looks as follows:

However, when trying to run this with Node.js it says Error: Callback function is not available with promise clients.
Do you have a solution to retrieve the insert IDs for the following INSERTS?

I’ve also tried with .then((result)=>{..}) which seems to work but the result.InsertID is always undefined?

Advertisement

Answer

Turns out it has to be result.insertId instead of result.insertID and then it doesn’t return NULL anymore..

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement