Bläddra i källkod

sqlpreprocess enhancements

production
pb 1 år sedan
förälder
incheckning
f833a1ea53
1 ändrade filer med 7 tillägg och 4 borttagningar
  1. 7
    4
      index.js

+ 7
- 4
index.js Visa fil

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

Laddar…
Avbryt
Spara