diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index 39b727be..688a4766 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -151,22 +151,26 @@ module.exports = function(RED) { node.error(err,msg); } else { - if (rows.constructor.name === "OkPacket") { - msg.payload = JSON.parse(JSON.stringify(rows)); - } - else if (rows.constructor.name === "Array") { - if (rows[0] && rows[0].constructor.name === "RowDataPacket") { - msg.payload = rows.map(v => Object.assign({}, v)); - } - else if (rows[0] && rows[0].constructor.name === "Array") { - if (rows[0][0] && rows[0][0].constructor.name === "RowDataPacket") { - msg.payload = rows.map(v => v.map(w => Object.assign({}, w))); - } - else { msg.payload = rows; } - } - else { msg.payload = rows; } - } - else { msg.payload = rows; } + // if (rows.constructor.name === "OkPacket") { + // msg.payload = JSON.parse(JSON.stringify(rows)); + // } + // else if (rows.constructor.name === "Array") { + // if (rows[0] && rows[0].constructor.name === "RowDataPacket") { + // msg.payload = rows.map(v => Object.assign({}, v)); + // } + // else if (rows[0] && rows[0].constructor.name === "Array") { + // if (rows[0][0] && rows[0][0].constructor.name === "RowDataPacket") { + // msg.payload = rows.map(function(v) { + // if (!Array.isArray(v)) { return v; } + // v.map(w => Object.assign({}, w)) + // }); + // } + // else { msg.payload = rows; } + // } + // else { msg.payload = rows; } + // } + // else { msg.payload = rows; } + msg.payload = rows; send(msg); status = {fill:"green",shape:"dot",text:"OK"}; node.status(status); diff --git a/storage/mysql/package.json b/storage/mysql/package.json index 19440fac..285e6b04 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-mysql", - "version": "0.1.8", + "version": "0.1.10", "description": "A Node-RED node to read and write to a MySQL database", "dependencies": { "mysql": "^2.18.1"