danke. leider geht meine umsetzung davon nicht:
var test = new Promise(function(resolve, reject) {db.all(statment, function(err, rows) {
resolve(rows);
})});
var user_id;
var m_id;
var pro = function () {
test.then(function (rows) {
var last_index = rows.length - 1;
user_id = rows[last_index].user_id;
m_id = rows[last_index].mitarbeiter_id;
var statmentLokal = SQL_INSERT_USER_MITARBEITER.replace(/\?user_id/g, user_id);
statmentLokal = statmentLokal.replace(/\?m_id/g, m_id);
db.run(statmentLokal);
})
.then(function() {
var statmentLokal = SQL_INSERT_SKILL.replace(/\?m_id/g, m_id);
statmentLokal = statmentLokal.replace(/\?skill/g, "'" + data.skill + "'");
statmentLokal = statmentLokal.replace(/\?subskill/g, "'" + data.subskill + "'");
statmentLokal = statmentLokal.replace(/\?nivau/g, "'" + data.nivau + "'");
db.run(statmentLokal);
})
.then(function(){
var statmentLokal = SQL_REPLACE_SKILL.replace(/\?m_id/g, m_id);
statmentLokal = statmentLokal.replace(/\?skill/g, "'" + data.skill + "'");
statmentLokal = statmentLokal.replace(/\?subskill/g, "'" + data.subskill + "'");
statmentLokal = statmentLokal.replace(/\?nivau/g, "'" + data.nivau + "'");
db.run(statmentLokal);
})
.catch(function (error) {
console.log(error.message);
});
}