Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing status attribute names
  • Loading branch information
Evan Langlais committed Apr 29, 2019
1 parent 5e3f416 commit 92bdd90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gateway.go
Expand Up @@ -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")
}
}
Expand Down

0 comments on commit 92bdd90

Please sign in to comment.