diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index c1d3e4f4..6ec4df5c 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -141,7 +141,7 @@ module.exports = function(RED) { }.bind(this)); }; } - node.mydbConfig.pool.query(msg.topic, bind, function(err, rows) { + node.mydbConfig.connection.query(msg.topic, bind, function(err, rows) { if (err) { status = {fill:"red",shape:"ring",text:"Error: "+err.code}; node.status(status); @@ -156,7 +156,9 @@ module.exports = function(RED) { status = {fill:"green",shape:"dot",text:"OK"}; node.status(status); } - //node.mydbConfig.connection.release(); + 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 f2995a57..690be998 100644 --- a/storage/mysql/package.json +++ b/storage/mysql/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-mysql", - "version": "0.1.2", + "version": "0.1.3", "description": "A Node-RED node to read and write to a MySQL database", "dependencies": { "mysql": "^2.18.1"