Sfoglia il codice sorgente

Fixed output files

pull/16/head
pb 1 anno fa
parent
commit
d5f6e24fb9
1 ha cambiato i file con 7 aggiunte e 6 eliminazioni
  1. 7
    6
      index.js

+ 7
- 6
index.js Vedi File

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


Loading…
Annulla
Salva