Better fix

And bump version
This commit is contained in:
Ben Hardill 2022-01-05 10:33:26 +00:00
parent d5cf7c7a9d
commit aed1c315ea
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
2 changed files with 3 additions and 2 deletions

View File

@ -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"

View File

@ -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 {