node-red-node-mysql
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -116,16 +116,23 @@ | ||
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) { | ||
bind = msg.payload; | ||
node.mydbConfig.pool.config.queryFormat = function(query, values) { | ||
if (!values) { | ||
return query; | ||
} | ||
return query.replace(/\:(\w+)/g, function(txt, key) { | ||
if (values.hasOwnProperty(key)) { | ||
return this.escape(values[key]); | ||
node.mydbConfig.pool.on('acquire', function(connection) { | ||
connection.config.queryFormat = function(query, values) { | ||
if (!values) { | ||
return query; | ||
} | ||
return txt; | ||
}.bind(this)); | ||
}; | ||
return query.replace(/\:(\w+)/g, function(txt, key) { | ||
if (values.hasOwnProperty(key)) { | ||
return this.escape(values[key]); | ||
} | ||
return txt; | ||
}.bind(this)); | ||
}; | ||
}); | ||
} | ||
@@ -132,0 +139,0 @@ node.mydbConfig.pool.query(msg.topic, bind, function(err, rows) { |
{ | ||
"name": "node-red-node-mysql", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A Node-RED node to read and write to a MySQL database", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15926
188