Update More than one Value with SQLITE

Hello,

I started to work with SQLite a few days ago and need to update some rows with values of different variables.
So i tried to use a funktion like this (followed by the sqlite node):

msg.payload = global.get("GlImportArrayInt");
var Int1 = msg.payload.value[0];
var Int2 = msg.payload.value[1];

var DataSQLite = {
    topic : 
    "UPDATE `Data` SET `Value`="+Int1+" WHERE `_rowid_`='1';"+
    "UPDATE `Data` SET `Value`="+Int2+" WHERE `_rowid_`='2';"
};

My problem is, this just updates row1, but i need more rows to be updated.
Any Idea how to make this work, or is there a completely other solution?
The values are also aviable as an array. I just started with all this and hope you can help me.

You could try using the 'BEGIN TRANSACTION' and 'COMMIT'. See: http://www.sqlitetutorial.net/sqlite-transaction/

I've already tried this version, but it didn't work for me.

But i just found the problem, i used the "Via.msg.topic" option as </> SQL Query in the sqlite node options.
Now i switched to Batch without response and included the 'BEGIN TRANSACTION' and 'COMMIT' again and now it works.

It would be nice if someone can explain whats the difference between those two options, but it works for me now.

1 Like