today, trying to make a tag system for a discord bot, I finally got to this query:
INSERT INTO tags_935339484147503174 (name, description, author, uses, id) VALUES ('error4', '\n> 📝 El bot se apaga cada que sale un error\n\nEn node 16 en adelante creo el bot siempre se apagara cada que tenga un error pero solo añadiendo este sencillo codigo ya no pasara.\n\n```js\nprocess.on(\'unhandledRejection\', error => {\n console.error(error);\n});\n\nclient.on(\'shardError\', error => {\n console.error(error);\n});\n```', '573991320897716224', 0, 'EKBL63t')
The problem is, that when I execute it from the server
let values = `('${tag.name}', '${tag.description}', '${tag.author ?? '796767810054258719'}', ${tag.uses ?? 0}, '${id}')`.replace(/\n/gm, "\\n")
let query = `INSERT INTO tags_${guildf.id} (name, description, author, uses, id) VALUES ${values}`
console.log(query)
this._pool.getConnection((_err, con) => {
con.query(query, (err) => {
if(err) rej(err)
})
con.release()
})
It makes nothing, BUT when I execute it from a MySQL Client like HEIDISQL or PHPMyAdmin it actually works, what seems a little to strange for me, because everything points that the error is in the query on JS side, but I can't find such error, would someone please help me? Thanks
Just an update: I'm getting ER_TRUNCATED_WRONG_VALUE_FOR_FIELD and I know it's for having an incorrect db collation, can someone tell me which one would I need to store that text? I'm actually using utf8mb4_0900_ai_ci