diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index 039b01c0..d62fb9f1 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -116,7 +116,7 @@ module.exports = function(RED) { if (Array.isArray(msg.payload)) { bind = msg.payload; node.mydbConfig.pool.on('acquire', function(connection) { - connection.config.queryFormat = null; + connection.config.queryFormat = null; }); } else if (typeof msg.payload === 'object' && msg.payload !== null) { @@ -142,34 +142,12 @@ 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(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:RED._("mysql.status.ok")}; node.status(status); } if (done) { done(); } - // if (node.mydbConfig.pool._freeConnections.indexOf(node.mydbConfig.connection) === -1) { - // node.mydbConfig.connection.release(); - // } }); } else { diff --git a/storage/mysql/package.json b/storage/mysql/package.json index dd06c3ec..ddde5f05 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,9 +1,9 @@ { "name": "node-red-node-mysql", - "version": "0.3.0", + "version": "1.0.0-beta", "description": "A Node-RED node to read and write to a MySQL database", "dependencies": { - "mysql": "^2.18.1" + "mysql2": "^2.3.3" }, "repository": { "type": "git",