mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
fix mysql array handling
This commit is contained in:
parent
911348790c
commit
6095723308
@ -19,9 +19,8 @@ module.exports = function(RED) {
|
|||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
function checkVer() {
|
function checkVer() {
|
||||||
node.connection.query("SELECT version();", [], function(err, rows) {
|
node.pool.query("SELECT version();", [], function(err, rows, fields) {
|
||||||
if (err) {
|
if (err) {
|
||||||
node.connection.release();
|
|
||||||
node.error(err);
|
node.error(err);
|
||||||
node.status({fill:"red",shape:"ring",text:"Bad Ping"});
|
node.status({fill:"red",shape:"ring",text:"Bad Ping"});
|
||||||
doConnect();
|
doConnect();
|
||||||
@ -149,7 +148,7 @@ module.exports = function(RED) {
|
|||||||
node.error(err,msg);
|
node.error(err,msg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (rows.constructor.name === "OkPacket") {
|
if ( (rows.constructor.name === "OkPacket") || (rows.constructor.name === "Array")) {
|
||||||
msg.payload = JSON.parse(JSON.stringify(rows));
|
msg.payload = JSON.parse(JSON.stringify(rows));
|
||||||
}
|
}
|
||||||
else { msg.payload = rows; }
|
else { msg.payload = rows; }
|
||||||
@ -157,6 +156,7 @@ module.exports = function(RED) {
|
|||||||
status = {fill:"green",shape:"dot",text:"OK"};
|
status = {fill:"green",shape:"dot",text:"OK"};
|
||||||
node.status(status);
|
node.status(status);
|
||||||
}
|
}
|
||||||
|
node.mydbConfig.connection.release();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-mysql",
|
"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",
|
"description": "A Node-RED node to read and write to a MySQL database",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mysql": "^2.18.1"
|
"mysql": "^2.18.1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user