mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
parent
b35daf6bb7
commit
f2e28e715f
@ -121,7 +121,6 @@ module.exports = function(RED) {
|
||||
node.on("input", function(msg) {
|
||||
if (node.mydbConfig.connected) {
|
||||
if (typeof msg.topic === 'string') {
|
||||
//console.log("query:",msg.topic);
|
||||
var bind = Array.isArray(msg.payload) ? msg.payload : [];
|
||||
node.mydbConfig.connection.query(msg.topic, bind, function(err, rows) {
|
||||
if (err) {
|
||||
@ -129,7 +128,10 @@ module.exports = function(RED) {
|
||||
status = {fill:"red",shape:"ring",text:"Error"};
|
||||
}
|
||||
else {
|
||||
msg.payload = rows;
|
||||
if (rows.constructor.name === "OkPacket") {
|
||||
msg.payload = JSON.parse(JSON.stringify(rows));
|
||||
}
|
||||
else { msg.payload = rows; }
|
||||
node.send(msg);
|
||||
status = {fill:"green",shape:"dot",text:"OK"};
|
||||
}
|
||||
|
@ -1,18 +1,21 @@
|
||||
{
|
||||
"name" : "node-red-node-mysql",
|
||||
"version" : "0.0.18",
|
||||
"description" : "A Node-RED node to read and write to a MySQL database",
|
||||
"dependencies" : {
|
||||
"mysql" : "^2.16.0"
|
||||
"name": "node-red-node-mysql",
|
||||
"version": "0.0.19",
|
||||
"description": "A Node-RED node to read and write to a MySQL database",
|
||||
"dependencies": {
|
||||
"mysql": "^2.17.1"
|
||||
},
|
||||
"repository" : {
|
||||
"type":"git",
|
||||
"url":"https://github.com/node-red/node-red-nodes/tree/master/storage/mysql"
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/node-red/node-red-nodes/tree/master/storage/mysql"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"keywords": [ "node-red", "mysql" ],
|
||||
"node-red" : {
|
||||
"nodes" : {
|
||||
"keywords": [
|
||||
"node-red",
|
||||
"mysql"
|
||||
],
|
||||
"node-red": {
|
||||
"nodes": {
|
||||
"mysql": "68-mysql.js"
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user