I've been trying to follow the advice given in this post but still having problems
I've created a table using the inject node
CREATE TABLE myroute(id INTEGER PRIMARY KEY AUTOINCREMENT, ModeS TEXT, Reg TEXT, Type TEXT)
Viewing the table using DB Browser (on Windows) the table appears to be correct.
Using a function node I'm trying to insert the data from 3 messages into the database
(at the moment the messages are hard coded with values using an inject node msg.modeS=AE4589, msg.reg=58-2584, msg.type=C-17 - all entered as strings)
var sql = 'INSERT INTO myroute '
sql += '(ModeS, Reg, Type)'
sql += 'VALUES ('
sql += msg.modeS+', '
sql += msg.reg+', '
sql += msg.type
sql += ')'
msg.topic = sql
return msg;
When I try to insert the data I get
"Error: SQLITE_ERROR: no such column: AE4589"
I put a debug node on the msg.topic and I get this
INSERT INTO myroute (ModeS, Reg, Type)VALUES (AE4589, 58-2584, C-17)
which to me looks correct.
I've obviously made a mistake somewhere
If I put in actual values in the function node above it works Ok
Any help appreciated
Paul