1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x | 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:" + err); done(); } else { connection.query(sql, (err) => { connection.release(); Iif (err) { console.log(err); done(); } else { done(); } }); } }); }; |