mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	| @@ -113,10 +113,16 @@ module.exports = function(RED) { | |||||||
|                     if (typeof msg.topic === 'string') { |                     if (typeof msg.topic === 'string') { | ||||||
|                         //console.log("query:",msg.topic); |                         //console.log("query:",msg.topic); | ||||||
|                         var bind = []; |                         var bind = []; | ||||||
|                         if (Array.isArray(msg.payload)) { bind = msg.payload; } |                         if (Array.isArray(msg.payload)) { | ||||||
|  |                             bind = msg.payload; | ||||||
|  |                             node.mydbConfig.pool.on('acquire', function(connection) { | ||||||
|  |                                     connection.config.queryFormat = null; | ||||||
|  |                             }); | ||||||
|  |                         } | ||||||
|                         else if (typeof msg.payload === 'object' && msg.payload !== null) { |                         else if (typeof msg.payload === 'object' && msg.payload !== null) { | ||||||
|                             bind = msg.payload; |                             bind = msg.payload; | ||||||
|                             node.mydbConfig.pool.config.queryFormat = function(query, values) { |                             node.mydbConfig.pool.on('acquire', function(connection) { | ||||||
|  |                                 connection.config.queryFormat = function(query, values) { | ||||||
|                                     if (!values) { |                                     if (!values) { | ||||||
|                                         return query; |                                         return query; | ||||||
|                                     } |                                     } | ||||||
| @@ -127,6 +133,7 @@ module.exports = function(RED) { | |||||||
|                                         return txt; |                                         return txt; | ||||||
|                                     }.bind(this)); |                                     }.bind(this)); | ||||||
|                                 }; |                                 }; | ||||||
|  |                             }); | ||||||
|                         } |                         } | ||||||
|                         node.mydbConfig.pool.query(msg.topic, bind, function(err, rows) { |                         node.mydbConfig.pool.query(msg.topic, bind, function(err, rows) { | ||||||
|                             if (err) { |                             if (err) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user