fix sqlite array handling issue

to close #670
This commit is contained in:
Dave Conway-Jones 2021-09-13 11:10:04 +01:00
parent 1f2a25637b
commit c6f37d19a8
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "node-red-node-sqlite",
"version": "1.0.0",
"version": "1.0.1",
"description": "A sqlite node for Node-RED",
"dependencies": {
"sqlite3": "^5.0.2"

View File

@ -53,7 +53,10 @@ module.exports = function(RED) {
if (node.sqlquery == "msg.topic") {
if (typeof msg.topic === 'string') {
if (msg.topic.length > 0) {
bind = Array.isArray(msg.payload) ? msg.payload : [];
if (Array.isArray(msg.payload)) {
if (msg.payload.length === (msg.topic.split('$').length - 1) ) { bind = msg.payload; }
else { bind = []; }
}
node.mydbConfig.db.all(msg.topic, bind, function(err, row) {
if (err) { node.error(err,msg); }
else {