I have a NodeJs application and I am trying to insert some records in a MySql form, but when I run the code below I get the following message.
Code:
CadastroModel.prototype.cadastrarEstudio = function(estudio, callback) {
var sql = 'INSERT INTO estudio SET ?';
this._connection.query(sql, estudio, callback);
}
Error message:
{ Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''[{\"nomeEstudio\":\"TOP\",\"descricao\":\"dawoidja\",\"estado\":\"PR\",\"cidade' at line 1
In this case, I do not know where these '\' appeared, and I believe this is generating the error.
Has this ever happened to anyone else?