var mysql = require("mysql");
var fs = require("fs");
module.exports = function run(filename, pool, done) {
console.log("runsqlfile: reading file " + filename);
let sql = fs.readFileSync(filename, "utf8");
pool.getConnection((err, connection) => {
Iif (err) {
console.log("runsqlfile: error connecting");
done();
} else {
console.log("runsqlfile: connected");
connection.query(sql, (err, rows) => {
connection.release();
Iif (err) {
console.log(err);
done();
} else {
console.log("runsqlfile: run ok");
done();
}
});
}
});
};
|