Parcourir la source

Fixed output files

production
pb il y a 1 an
Parent
révision
d5f6e24fb9
1 fichiers modifiés avec 7 ajouts et 6 suppressions
  1. 7
    6
      index.js

+ 7
- 6
index.js Voir le fichier

@@ -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
})


Chargement…
Annuler
Enregistrer