diff --git a/gateway.go b/gateway.go index a6f957b..f2974f0 100644 --- a/gateway.go +++ b/gateway.go @@ -217,11 +217,11 @@ func (ws *socketConn) handleStatus(updates Packet) { } if value == 0 { - if _, err := dbConn.Exec("DELETE FROM `sd5-state`.? WHERE gen_id = ? AND status_code = '?'", table, generatorId, statusCode); err != nil { + if _, err := dbConn.Exec("DELETE FROM `sd5-state`.$1 WHERE gen_id = $2 AND status_code = '$3'", table, generatorId, statusCode); err != nil { fmt.Printf("Error removing status/fault: %v\n", err) } } else { - if _, err := dbConn.Exec("INSERT INTO `sd5-state`.? (gen_id, status_code) VALUES (?, '?') ON DUPLICATE KEY UPDATE gen_id = VALUES(gen_id), status_code = VALUES(status_code)", table, generatorId, statusCode); err != nil { + if _, err := dbConn.Exec("INSERT INTO `sd5-state`.$1 (gen_id, status_code) VALUES ($2, $3) ON DUPLICATE KEY UPDATE gen_id = VALUES(gen_id), status_code = VALUES(status_code)", table, generatorId, statusCode); err != nil { fmt.Printf("Error setting status/fault: %v\n", err) } }