var execsql = require('execsql');
var callback = function(err,results){
if (err){
console.log("error is: ",err);
return;
}
console.log("results is: ",results);
}
var dbConfig = {
host: 'cloud-address',
user: 'db-user',
port: 3306,
password: 'user-pass'
},
sql = 'use test-db;',
sqlFile = __dirname + '/db.sql';
execsql.config(dbConfig)
.exec(sql)
.execFile(sqlFile, function(err, results){
console.log(results);
callback(err, results);
}).end();
callback(błąd, wyniki); va dendro de la promesa, recuerda que node es asíncrono