更新时间:2023-02-14 12:33:41
我获得了此查询的解决方案并对其进行了回答,以便将来可以为其他人提供帮助。
我正在使用 require('require-sql');
导入sp.sql文件,然后替换 \n \r
带空格。
它可以在各自的数据库中工作并创建存储过程。
I got the solution of my this query and answering it so that could help anyone else in future.
I am importing my sp.sql file using require('require-sql');
Then replacing \n\r
with space.
It works and create stored procedure in respective database.
var query = require(path.join(_dirname, '/app/helper/sql/sp_distribute_all_data.sql'));
try {
conn(dbname).query(query.replace(/\r?\n|\r/g, " "), function (err, result) {
if (err) {
console.log("ERROR:::", err);
resolve({
status: false,
feedback: err
});
} else {
console.log("RESULT:::", result);
resolve({
status: true,
companyId: companyId,
feedback: 'Company configured successfully !!'
});
}
});
} catch (error) {
var stack = error.stack;
console.log(stack);
}