node-red-node-mysql
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -22,5 +22,4 @@ | ||
function checkVer() { | ||
node.connection.query("SELECT version();", [], function(err, rows) { | ||
node.pool.query("SELECT version();", [], function(err, rows, fields) { | ||
if (err) { | ||
node.connection.release(); | ||
node.error(err); | ||
@@ -88,9 +87,9 @@ node.status({fill:"red",shape:"ring",text:"Bad Ping"}); | ||
this.on('close', function (done) { | ||
this.on('close', function(done) { | ||
if (this.tick) { clearTimeout(this.tick); } | ||
if (this.check) { clearInterval(this.check); } | ||
node.connected = false; | ||
node.connection.release(); | ||
// node.connection.release(); | ||
node.emit("state"," "); | ||
node.pool.end(function (err) { done(); }); | ||
node.pool.end(function(err) { done(); }); | ||
}); | ||
@@ -135,7 +134,7 @@ } | ||
bind=msg.payload; | ||
node.mydbConfig.connection.config.queryFormat = function (query, values) { | ||
if (!values){ | ||
node.mydbConfig.connection.config.queryFormat = function(query, values) { | ||
if (!values) { | ||
return query; | ||
} | ||
return query.replace(/\:(\w+)/g, function (txt, key) { | ||
return query.replace(/\:(\w+)/g, function(txt, key) { | ||
if (values.hasOwnProperty(key)) { | ||
@@ -146,5 +145,5 @@ return this.escape(values[key]); | ||
}.bind(this)); | ||
}; | ||
}; | ||
} | ||
node.mydbConfig.connection.query(msg.topic, bind, function(err, rows) { | ||
node.mydbConfig.pool.query(msg.topic, bind, function(err, rows) { | ||
if (err) { | ||
@@ -156,3 +155,3 @@ status = {fill:"red",shape:"ring",text:"Error: "+err.code}; | ||
else { | ||
if (rows.constructor.name === "OkPacket") { | ||
if ( (rows.constructor.name === "OkPacket") || (rows.constructor.name === "Array")) { | ||
msg.payload = JSON.parse(JSON.stringify(rows)); | ||
@@ -165,2 +164,3 @@ } | ||
} | ||
//node.mydbConfig.connection.release(); | ||
}); | ||
@@ -183,3 +183,3 @@ } | ||
node.on('close', function () { | ||
node.on('close', function() { | ||
if (node.tout) { clearTimeout(node.tout); } | ||
@@ -186,0 +186,0 @@ node.mydbConfig.removeAllListeners(); |
{ | ||
"name": "node-red-node-mysql", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A Node-RED node to read and write to a MySQL database", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
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
18975
7
1