MySql parsing error after a day of working

Dear All
after one day of normal behaviour I got this error from Mysql Node.

"Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?)' at line 1"

The sql code is :
msg.topic= "INSERT INTO batteria (valore) Values (?)";

The version of the node Mysql is 0.1.9

Node-RED version: v1.3.5
27 May 19:50:14 - [info] Node.js version: v12.22.1
27 May 19:50:14 - [info] Linux 5.10.17-v7+ arm LE

My first suspicion would be that you have something invalid in msg.payload.

Please add a debug Node - set to display the complete msg object - to the node feeding the mysql node and run it again. Then copy the opupit and paste it to a response.

Hello I even create a new sample one herewith enclosed:

28/5/2021, 18:58:29node: 207bb739.0591d8test : msg.payload : number

3.4

28/5/2021, 18:58:29node: fbad162d.058188INSERT INTO batteria (VoltLetti) Value ( ?) : msg.payload : number

3.4

28/5/2021, 18:58:29node: c423d7f7.a4b538msg : error

"Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?)' at line 1"

Can't really help if you don't do what I ask.

As for this new problem, payload should be an array.

See the readme : "node-red-node-mysql (node) - Node-RED" https://flows.nodered.org/node/node-red-node-mysql

Thanks, it worked.
I read the readme, and I was misled by the sentence:
"Typically the returned payload will be an array of the result rows."
I interpreted typically as an option not as a mandatory structure.

That isn't the relevant part, that is talking about what comes out of the node. It is the example in the readme under Preparing Queries where it shows the payload as an array that is relevant.

You said at the start that it worked ok for a day and then stopped working, I don't understand how that can be the case. I would not have expected it ever to have worked as you had it.

Actually, I simplified the data storage as some were redundant.
The fact that an array was needed was completely unclear to me.
Thanks for the support.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.