Error on INSERT INTO sqlite DB


When I insert some var values in sqlite DB, debug console send me this kind of message:

"Error: SQLITE_ERROR: near ":12": syntax error"
"Error: SQLITE_ERROR: near ":02": syntax error"

In a function i'm trying to insert with this command:

var newMsg = {
"topic": "INSERT INTO Consums (Data,Hora,GenFotoWL1,ConsumWL1,XarxaWL1,ExcedentWL1,XarxaKwh,FVKwh)"+"VALUES ( "+data+","+hora+","+FOTOV+","+CASA+","+XARXA+","+EXCD+","+XAKWHIII+","+FKWHIII+")"
return newMsg;

Where data, hora, FOTOV,..., are declarated vars in this function.
Some fields are text, others are REAL and others INT.

What is the meaning of this error?
I don't know whats wrong....

Thanks in advance

Hi @pautorras

the error means you have a syntax error in the SQL statement you are passing the sqlite node.

The best thing to do is to wire a Debug node to your function, configure it to show msg.topic and then you can see the actual SQL statement you are passing and see if you can spot what syntax error you have.

Strings need to be enclosed in quotes;