From 92bdd905bab211eca90272a797cc630560cdc646 Mon Sep 17 00:00:00 2001 From: Evan Langlais Date: Mon, 29 Apr 2019 14:30:17 -0400 Subject: [PATCH] Fixing status attribute names --- gateway.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gateway.go b/gateway.go index 96e8514..dea1daf 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 ? WHERE gen_id = ? AND status_code = ?", table, generatorId, statusCode); err != nil { + if _, err := dbConn.Exec("DELETE FROM `sd5-state`.? WHERE gen_id = ? AND status_code = '?'", table, generatorId, statusCode); err != nil { fmt.Printf("Error removing status/fault") } } else { - if _, err := dbConn.Exec("INSERT INTO ? (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`.? (gen_id, status_code) VALUES (?, '?') 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") } }