i need to known the primary key auto_increment value after an insert statement using xdevapi on mysql in nodejs.
my code is:
sqlQueries.getDBConnection(con =>
(function inner(con) {
var query = "INSERT INTO users (name) VALUES ('test')";
var executeSql = con.sql(query).execute();
con.close();
con.done();
return executeSql;
}(con)).then(function (res) {
/***********/
doSomethingWithTheId(id);
/***********/
con.close();
con.done();
}).catch(e => {
cl(e);
})
);
but i don't understand how do i get the id to use it in the doSomethingWIthTheId() function.
I tried to console.log(result) but it seems like i get an array of methods but i don't know how to reach the info i need.