浏览代码

Fixed output files

pull/16/head
pb 1年前
父节点
当前提交
d5f6e24fb9
共有 1 个文件被更改,包括 7 次插入6 次删除
  1. 7
    6
      index.js

+ 7
- 6
index.js 查看文件

@@ -554,12 +554,13 @@ shell_verse.acquireElevationState().then((isElevated) => {
noprerequisites : true
, cmdFn : function(args){
// PB : TODO -- Load loopback app !!! for ds
var sqlquery = fs.readFileSync(args._[1], { encoding: 'utf8'})
sqlquery = PATTERNAPI.includesql(sqlquery, path.dirname(args._[1])).then(sqlquery => {
sqlquery = " DECLARE @dsql NVARCHAR(MAX) = ' \r\n" + sqlquery.replace(/\'/g,"''")
fs.writeFileSync(args._[1].replace('.sql', '.d.temp.sql'), sqlquery, { encoding: 'utf8'}) // For intermediate processing
fs.writeFileSync(args._[1].replace('.sql', '.d.sql'), sqlquery + "\r\n'" + " EXEC sp_executesql @dsql" , { encoding: 'utf8'}) // Dynamic query output.
// PB : TODO -- Load loopback app !!! for db connection to execute intermediate results for query genereation !!!

return PATTERNAPI.includesql('', args._[1]).then(sqlquery => {
// Do what we need to with the output
// fs.writeFileSync(args._[1].replace('.sql', '.temp.g.sql'), sqlquery, { encoding: 'utf8'}) // For intermediate processing
fs.writeFileSync(args._[1].replace('.i', ''), sqlquery + "\n" , { encoding: 'utf8'}) // Dynamic query output.
// Static query debug output cannot be produced here... As EXEC sp_executesql must run to get the output. This can be produced by sqlfragmentexec in sql command mode.
return sqlquery
})


正在加载...
取消
保存