diff --git a/storage/sqlite/package.json b/storage/sqlite/package.json index 6060e957..a21715a6 100644 --- a/storage/sqlite/package.json +++ b/storage/sqlite/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-sqlite", - "version": "1.0.1", + "version": "1.0.2", "description": "A sqlite node for Node-RED", "dependencies": { "sqlite3": "^5.0.2" diff --git a/storage/sqlite/sqlite.js b/storage/sqlite/sqlite.js index c0648db6..9fb90846 100644 --- a/storage/sqlite/sqlite.js +++ b/storage/sqlite/sqlite.js @@ -50,13 +50,14 @@ module.exports = function(RED) { var bind = []; var doQuery = function(msg) { + bind = [] if (node.sqlquery == "msg.topic") { if (typeof msg.topic === 'string') { if (msg.topic.length > 0) { if (Array.isArray(msg.payload)) { if (msg.payload.length === (msg.topic.split('$').length - 1) ) { bind = msg.payload; } else { bind = []; } - } else { bind = []; } + } node.mydbConfig.db.all(msg.topic, bind, function(err, row) { if (err) { node.error(err,msg); } else {