@@ -335,7 +335,7 @@ module.exports = function (RED) {
335335 // node-mssql 5.x to 6.x changes
336336 // ConnectionPool.close() now returns a promise / callbacks will be executed once closing of the
337337 if ( node . pool && node . pool . close ) {
338- node . pool . close ( ) . catch ( ( ) => { } )
338+ node . pool . close ( ) . catch ( ( ) => { } ) ;
339339 }
340340 if ( updateStatusAndLog ) node . status ( { fill : 'grey' , shape : 'dot' , text : 'disconnected' } ) ;
341341 node . poolConnect = null ;
@@ -496,7 +496,7 @@ module.exports = function (RED) {
496496 node . paramsOptType = config . paramsOptType || 'none' ;
497497 node . rows = config . rows || 'rows' ;
498498 node . rowsType = config . rowsType || 'msg' ;
499- node . parseMustache = config . parseMustache || true ;
499+ node . parseMustache = ! ( config . parseMustache === false || config . parseMustache === 'false' ) ; // if not explicitly set to false, then enable mustache parsing
500500
501501 const setResult = function ( msg , field , value , returnType = 0 ) {
502502 // eslint-disable-next-line eqeqeq
@@ -752,10 +752,11 @@ module.exports = function (RED) {
752752 }
753753 }
754754
755+ const promises = [ ] ;
756+ const resolvedTokens = { } ;
757+ let tokens ;
755758 if ( node . parseMustache ) {
756- const promises = [ ] ;
757- const tokens = extractTokens ( mustache . parse ( msg . query ) ) ;
758- const resolvedTokens = { } ;
759+ tokens = extractTokens ( mustache . parse ( msg . query ) ) ;
759760 tokens . forEach ( function ( name ) {
760761 const envName = parseEnv ( name ) ;
761762 if ( envName ) {
@@ -789,7 +790,8 @@ module.exports = function (RED) {
789790 }
790791 }
791792 } ) ;
792-
793+ }
794+ if ( tokens && tokens . size > 0 ) {
793795 Promise . all ( promises ) . then ( function ( ) {
794796 const value = mustache . render ( msg . query , new NodeContext ( msg , node . context ( ) , null , false , resolvedTokens ) ) ;
795797 msg . query = value ;
0 commit comments