浏览代码

sqlpreprocess enhancements

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

+ 7
- 4
index.js 查看文件

@@ -554,12 +554,15 @@ 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]))
fs.writeFileSync(args._[1] + '.d.sql', sqlquery, { 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.
return sqlquery
})

return sqlquery

// // PB : TODO -- move to dsql preprocesor
// // var sqlquery = 'SET @dsql = @dsql + ' + "'" + ('' + fs.readFileSync(args._[1])).replace(/\'/g,"''") + "'"

正在加载...
取消
保存