sql-insert

Improve SQL INSERT query to avoid sql injections

[亡魂溺海] 提交于 2020-11-29 19:05:17
问题 I am using pymyql/mysql-connector to write the messages to mysql database. The messages are processed on callback (paho.mqtt callback) from mqtt broker.I have 4 different tables and based on the message type, I am inserting messages into database. I have written the insert queries as below. this way of writing leads to sql injections it seems.Any suggestions how can I improve the insert query statements? # callback attached to paho.mqtt.client def on_message(self, client, userdata, msg): if

Improve SQL INSERT query to avoid sql injections

与世无争的帅哥 提交于 2020-11-29 19:03:19
问题 I am using pymyql/mysql-connector to write the messages to mysql database. The messages are processed on callback (paho.mqtt callback) from mqtt broker.I have 4 different tables and based on the message type, I am inserting messages into database. I have written the insert queries as below. this way of writing leads to sql injections it seems.Any suggestions how can I improve the insert query statements? # callback attached to paho.mqtt.client def on_message(self, client, userdata, msg): if