|
|
@@ -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,"''") + "'" |